我的第一个表名是UserClient
,它包含UserTrainerID
。使用UserTrainerID
,第二个表格为UserTrainer
,其中包含UserID
(我希望使用UserID
了解UserTrainer
的{{1}},现在是第三个表格为UserTrainerID
,在User
的帮助下,我想获得userID
。
答案 0 :(得分:0)
Select a.username from t3 a,t2 b,t1 c
where a.userid=b.userid and b.UserTrainerID= c.UserTrainerID ;
答案 1 :(得分:0)
这是连接三个表的语法,我希望你能够相应地加入你的表:
SELECT t1.col, t3.col FROM table1
join table2 ON table1.primarykey = table2.foreignkey
join table3 ON table2.primarykey = table3.foreignkey