seelct a.*
from list a,Pinst b,[Proc] c
where a.[user]='acxt'
and a.PINTID=b.ID
and b.RocID=c.ID
and c.PSetID=363
from list a,Pinst b,[Proc] c
where a.[user]='acxt'
and a.PINTID=b.ID
and b.RocID=c.ID
and c.PSetID=363
FROM list
WHERE EXISTS
(
SELECT *
FROM PInst b
WHERE a.PINTID=ID
AND EXISTS
(
SELECT *
FROM Proc
WHERE ID=b.rocID
AND PSetID = 363
)
)
AND [USER]='acxt'
SELECT a.*
FROM list a LEFT JOIN
(SELECT ID FROM PInst c WHERE EXISTS
(SELECT ID FROM [Proc] WHERE PSetID=363 AND rocID=c.rocID))b
ON a.PINTID=b.ID AND a.[USER]='acxt'
SELECT distinct L.*
FROM list L left join PInst I on L.PINTID = I.ID
left join [Proc] P on I.rocID = P.ID
where L.[USER]='acxt' AND I.ID is not null and P.ID is not null and P.PSetID=363
select a.* from list a
join PInst b on b.ID=a.PINID
join [Proc] c on c.ID=b.rocID
where a.[USER]='acxt' and c.PSetID=363
不过一般能联表的尽量联表,不要用in,exists...
select distinct a.* from list a
join PInst b on b.ID=a.PINID
join [Proc] c on c.ID=b.rocID
where a.[USER]='acxt' and c.PSetID=363