34,590
社区成员
发帖
与我相关
我的任务
分享
select top 1 * from (select cId,cName,cNumber,cAddress,cProducts,case when cId>0 then '客户' end as Type,case when cId!=0 then cId+1 end as id from Customers where cUId=1
union select pId,pName,pNumber,pAddress,pProducts,case when pId>0 then '供应商' end as Type,case when pId>0 then pId+2 end as id from Providers where pUId=1
union select hId,hName,hNumber,hAddress,hProducts,case when hId>0 then '潜在客户' end as Type,case when hId>0 then hId+3 end as id from HideCustomers where hUId=1
)Customers where Customers.cId not in (select top 0 cId from(select cId from Customers where cUId=1 union select pId from Providers where pUId=1 union select hId from HideCustomers where hUId=1)Customers order by Customers.cId) order by Customers.cId