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
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?
  • ¥15 求daily translation(DT)偏差订正方法的代码
  • ¥15 js调用html页面需要隐藏某个按钮
  • ¥15 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?
  • ¥20 java项目连接sqlserver时报ssl相关错误
  • ¥15 一道python难题3
  • ¥15 牛顿斯科特系数表表示
  • ¥15 arduino 步进电机
  • ¥20 程序进入HardFault_Handler