我如何在单一查询中
获取uID的mID(1)(33,34,35) 选择文本mID(33,34,35){基于上述结果} 选择名称,其中uID(表b(5,6)中mID的用户ID){基于上述结果}
输出
txt1 user5
txt3 user6
我知道的唯一身份就是uID。如何在单个查询中执行此操作。
TableA TableB TableC
uID mID mID Text uID uID Name
1 33 33 txt1 5 1 user1
2 34 34 txt2 5 2 user2
1 35 35 txt3 6 5 user5
2 33 6 user6
2 34
答案 0 :(得分:1)
select b.Text, c.Name
from TableA a
inner join TableB b on a.mID = b.mID
inner join TableC c on b.uID = c.uID
where a.uID = 1