Mysql 基于一个列名连接三个不同的表
最终产量Mysql 基于一个列名连接三个不同的表,mysql,Mysql,最终产量 table A amount user_id 100 abc 200 cdf 300 def table B Idno user_id 10 abc 202 def table C Idno user_id 498 cdf 我知道把两张桌子连在一起 Idno user_id amount 10 abc 100 202 def 200 498
table A
amount user_id
100 abc
200 cdf
300 def
table B
Idno user_id
10 abc
202 def
table C
Idno user_id
498 cdf
我知道把两张桌子连在一起
Idno user_id amount
10 abc 100
202 def 200
498 cdf 300
但我的问题是,如何在两个表中显示最终输出所示的所有用户id量这是您想要的吗
table A
amount user_id
100 abc
200 cdf
300 def
table B
Idno user_id
10 abc
202 def
table C
Idno user_id
498 cdf
select A.amount,B.Idno,B.user_id from B inner join A on A.user_id=B.user_id;
从他的表格来看,我认为这应该是正确的答案。表C和表B的结构相同吗?只维护一个表,一个是存储,另一个是存储shoppe@MostyMostacho我已经接受了所有的答案……但我没有得到答案,我没有接受:)