81,092
社区成员
发帖
与我相关
我的任务
分享
select * from ywuser.vsdossier vsd
where startserialno not in(select visaserialno
from ywuser.vsmark vsm
where vsd.visacode = vsm.visacode
and flag not in ('0', '1'))
and endserialno not in(select visaserialno
from ywuser.vsmark vsm
where vsd.visacode = vsm.visacode
and p.flag not in ('0', '1'))
select p.visacode, p.visaserialno
from ywuser.vsmark p,
(select p.visacode, p.visaserialno
from ywuser.vsmark p, ywuser.vsdossier a
where p.visacode = a.visacode
and p.flag not in ('0', '1')
and p.visaserialno >= a.startserialno
and p.visaserialno <= a.endserialno) b //这个是区间的数据
where p.visacode = b.visacode
and p.visaserialno <> b.visaserialno
and p.flag not in ('0', '1');
这样写不可以么? 我感觉可以啊。不过最后一句and p.flag not in ('0', '1');应该不用加吧?