PHP三个SQL select语句

时间:2015-05-25 23:34:25

标签: php sql

我有一个包含三个表的数据库,我正在尝试获取所有表的一些信息

teams - >包含事件/活动,并使用另一个表的userIds来标识该行。

facilities - >包含一个团队列表(包括存储在活动中的id)和分配给每个团队的属性,例如名称远离颜色等。

activities - >包含可在

预订的所有设施活动清单

我想创建一个select语句,使用facility表来获取主队和客队,然后查找球队名称(不是存储在活动数据库中的ID)并获取名称$select = "SELECT *, teams.name FROM activities, teams WHERE (SELECT * FROM teams WHERE teams.id=activities.teamIdAway) activities.status=(:s) AND activities.dateStart >= (:start) AND activities.dateEnd <= (:end) AND activities.facilityId=(:f)";

我使用了以下sql

ruby 1.9.3

1 个答案:

答案 0 :(得分:1)

您需要与<head> <title>simple-todos</title> </head> <body> <h1>Welcome to my First Meteor App</h1> {{ >form }} {{ >results }} {{ >hello }} </body> <template name="hello"> <button>Click Me</button> <p>You've pressed the button {{counter}} times.</p> </template> <template name="form"> <form > <input type="text" name = "info" placeholder="" /> </form> </template> <template name="results"> <p> {{ result }} </p> </template> 表进行两次加入,一个用于主队,另一个用于客队。

teams