开发者

How to do join with multiple conditions in mysql

How can i it in single query

Get mID for uID(1) (33,34,35) select text where mID (33,34,35){based on the above result} select 开发者_如何学PythonName where uID(user id of mID in table b (5,6)){based on the above result}

Output

txt1  user5
txt3  user6

The only id I know is uID. How to do this in a single query.

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


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
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜