我有这个设置:
表成员
datetime.strptime (time , "%Y-%m-%d %H:%M:%S.%f %Z")
表团队
id_member name
---------------
现在我想在html表格中显示所有团队的这些字段: id_team,leader name,member1的name,member2的名称
尝试了多个选项的多个查询,但是当一个成员位于多个团队中时出现问题,显示了错误的结果(所有组合)
答案 0 :(得分:0)
尝试使用如下连接查询
select TEAM.id_team, LEADER.name, MEMBER1.name, MEMBER2.name
from teams as TEAM
join members as LEADER on(LEADER.id_member=TEAM.id_leader)
join members as MEMBER1 on(MEMBER1.id_member=TEAM.id_member1)
join members as MEMBER2 on(MEMBER2.id_member=TEAM.id_member2)