select name from table1 A where
exists (select * from table2 B where A.id = B.id)
uion all
select ‘’ from table1 A where
not exists (select * from table2 B where A.id = B.id)
exists (select * from table2 B where A.id = B.id)
uion all
select ‘’ from table1 A where
not exists (select * from table2 B where A.id = B.id)
表1 ID NAME 表2 ID 表3 ID NAME
1 A 1 3 C
2 B ‘’
有一条记录为:
1 3 ‘’
我想取出来的时候是:A C ‘’
isnull(b.ActionName,a.actionsecondid) as 当前动作,isnull(c.ActionName,a.actionsecondid) as 特殊描述,a.WorkDesc2 as 工作描述2,a.WorkDesc3 as 工作描述3
from tabPersonReport a
left join tabPersonAction b, tabJapanAction c on (a.ActionSecondID=b.ActionSecondID and a.workdesc1= c.ActionSecondID) AND a.employeeid='02091'
请帮我看看这句句子哪里有错?
isnull(b.ActionName,a.actionsecondid) as 当前动作,isnull(c.ActionName,a.actionsecondid) as 特殊描述,a.WorkDesc2 as 工作描述2,a.WorkDesc3 as 工作描述3
from tabPersonReport a
left join tabPersonAction b on a.ActionSecondID=b.ActionSecondID
left join tabJapanAction c on a.workdesc1= c.ActionSecondID
where a.employeeid='02091'
服务器: 消息 208,级别 16,状态 1,行 1
对象名 'tabPersonReport' 无效。
服务器: 消息 208,级别 16,状态 1,行 1
对象名 'tabPersonAction' 无效。
服务器: 消息 208,级别 16,状态 1,行 1
对象名 'tabJapanAction' 无效。