select * from b where serid in (select SerID from a where perid='aaa')
select * from b where serid not in (select SerID from a where perid='aaa')
select * from b where serid not in (select SerID from a where perid='aaa')
exists(select * from A where charindex(b.serid,a.serid)=0 )
select * from B where
exists(select * from A where charindex(b.serid,a.serid)>0 )
select * from 表B where charindex (','+serid+',',(select ','+serid+',' from 表A where pid=aaa))<0 --在表B里面不存在
select * from 表B where charindex (serid,',(select ','+serid+',' from 表A where pid=aaa))<0 --在表B里面不存在
select b.* from 表A a,表B b where charindex(b.SerID,','+a.SerID+',')=0 and a.PID='aaa'存在:
select b.* from 表A a,表B b where charindex(b.SerID,','+a.SerID+',')>0 and a.PID='aaa'
select b.* from 表A a,表B b where charindex(','+b.SerID+',',','+a.SerID+',')=0 and a.PID='aaa'存在:
select b.* from 表A a,表B b where charindex(','+b.SerID+',',','+a.SerID+',')>0 and a.PID='aaa'