17,086
社区成员
发帖
与我相关
我的任务
分享
--这样试试
not exists (select a.pxRefObjectInsName from workbasket a where b.PXINSNAME=a.PXREFOBJECTINSNAME)
and not exists(select c.pxRefObjectInsName from worklist c where b.PXINSNAME=c.PXREFOBJECTINSNAME)
--在关联字段建个索引
--试试 这样
Select b.pxInsName AS "pxInsName",
case when b.pxInsName = a.pxRefObjectInsName then a.PXASSIGNEDOPERATORID
when b.pxInsName = c.pxRefObjectInsName then c.PXASSIGNEDOPERATORID end AS "AssignTo",
b.THERAPEUTICAREA AS "TherapeuticArea"
FROM worklist a , workbasket c ,work b
where b.pxInsName = a.pxRefObjectInsName AND b.pxInsName = c.pxRefObjectInsName AND
b.pxInsName is not null
union all
Select b.pxInsName AS "pxInsName",'' AS "AssignTo",b.THERAPEUTICAREA AS "TherapeuticArea
FROM work b
WHERE b.pxInsName is not null
and not exists (select 1 from workbasket a where b.PXINSNAME=a.PXREFOBJECTINSNAME)
and not exists (select c.pxRefObjectInsName from worklist c where b.PXINSNAME=c.PXREFOBJECTINSNAME)