有三个表 info,person,codeinfo
nameid1,nameid2,typeid,statusid,info
p1, p2, c1, c2, 信息person
nameid,name
p1, 张三
p2, 李四code
codeid,code
c1, 种类1
c2, 种类2现在想得到:
张三,李四,种类1,种类2,信息。
请教各位老师这个SQL应该怎么写。谢谢。
nameid1,nameid2,typeid,statusid,info
p1, p2, c1, c2, 信息person
nameid,name
p1, 张三
p2, 李四code
codeid,code
c1, 种类1
c2, 种类2现在想得到:
张三,李四,种类1,种类2,信息。
请教各位老师这个SQL应该怎么写。谢谢。
(select name from person t3 where t3.nameid = t1.nameid2),
(select code from code t4 where t4.codeid = t1.typeid),
(select code from code t5 where t5.codeid = t1.statusid),
t1.info
from info t1;