dongnao3990 2013-09-29 05:41
浏览 24
已采纳

使用基础部分与PHP

I am using the sections feature in the Foundation framework, "http://foundation.zurb.com/docs/components/section.html#panel2".

My website is for a soccer club where I have a bunch of teams in a database table named "team". The team table has the following columns: team_id,team_name.

I also have a table named "players".

The players table has the following columns: id,first_name,last_name,team_id.

I want to make a section for each team where the tab is labeled the "team_name" from the "team" table, and the content of that section is all players on that team and will list all player names in that section.

  • 写回答

1条回答 默认 最新

  • dongshilve4392 2013-09-29 05:44
    关注

    If I'm understanding the question correctly, then you can just get the team id and then use:

    SELECT * FROM `players` WHERE `team_id`='7';
    

    With "7" being an example id. Alternately you can have it all in one query:

    SELECT * FROM `players` t1 INNER JOIN `teams` t2 ON t2.team_name = 'example' AND t1.team_id = t2.team_id;
    

    or

    SELECT * FROM `players` t1, `teams` t2 WHERE t2.team_name = 'example' AND t1.team_id = t2.team_id
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 求数据集和代码#有偿答复
  • ¥15 关于下拉菜单选项关联的问题
  • ¥20 java-OJ-健康体检
  • ¥15 rs485的上拉下拉,不会对a-b<-200mv有影响吗,就是接受时,对判断逻辑0有影响吗
  • ¥15 使用phpstudy在云服务器上搭建个人网站
  • ¥15 应该如何判断含间隙的曲柄摇杆机构,轴与轴承是否发生了碰撞?
  • ¥15 vue3+express部署到nginx
  • ¥20 搭建pt1000三线制高精度测温电路
  • ¥15 使用Jdk8自带的算法,和Jdk11自带的加密结果会一样吗,不一样的话有什么解决方案,Jdk不能升级的情况
  • ¥15 画两个图 python或R