说具体点: I wrote a query it select records from table 1 which has corresponding records in table 2 and table 3. The query works fine on my machine (server 2005). I moved to clients Server (server 2000), the query works for most cases, however there a few records get selected even they don't have any corresponding records in table 2 and table 3 -- run select query on table 2 and 3 returns nothing. We can't figure out why this is happening?
l*u
4 楼
query 如下: select distinct prdoco from dbo.f43121 A where (not exists (select 1 from dbo.f43121 B where A.prdoco=b.prdoco and A.prdcto=b.prdcto AND A.PRKCOo=B.PRKCOO and B.PRMATC='2' AND((B.prdoc not in (SELECT distinct prdoc FROM dbo.f43121, dbo.f0411 where prdoc=rpdoc and prdct=rpdct and prkco=rpkco)) or B.prdoc not in (SELECT distinct prdoc FROM dbo.f43121, dbo.f0911 where prdoc=gldoc and prdct=gldct and prkco=glkco))))
【在 l********u 的大作中提到】 : query 如下: : select distinct prdoco from dbo.f43121 A where : (not exists : (select 1 from dbo.f43121 B where : A.prdoco=b.prdoco : and A.prdcto=b.prdcto : AND A.PRKCOo=B.PRKCOO : and B.PRMATC='2' AND((B.prdoc not in : (SELECT distinct prdoc FROM dbo.f43121, dbo.f0411 : where prdoc=rpdoc and prdct=rpdct and prkco=rpkco))