有两张桌子 表1
id --------- name
10001 Abc
10002 Xyz
表2
fromid ------ toid ------ message
10001 10002嗨
我希望结果为
name ----- name1 ------ message
Abc Xyz嗨
帮助将不胜感激
答案 0 :(得分:0)
select t1.name as name, t2.name as name1, t3.message
from table2 as t3
join table1 as t2 on t3.fromid = t2.id
join table1 as t1 on t3.toid = t1.id
我认为这将解决您的问题。