select *
from vsdossier vr
where 1 = 1
and exists (select 1
from vs vk
where vk.visaserialno >= vr.startserialno
and vk.visaserialno <= vr.endserialno
and vk.flag not in ('0', '1')
and vk.visacode = vr.visacode)题目内后面意思没看明白
from vsdossier vr
where 1 = 1
and exists (select 1
from vs vk
where vk.visaserialno >= vr.startserialno
and vk.visaserialno <= vr.endserialno
and vk.flag not in ('0', '1')
and vk.visacode = vr.visacode)题目内后面意思没看明白
解决方案 »
- 怎样批量"同时"复制文件?
- JFreeChart做成的图片中文字乱码,求解!
- 如何遍历出数据
- jsp中如何使用HTTP协议完成文件上传功能,谁有源代码可以发来看看吗?
- struts中的select问题~UP有分,分不够再加~
- html:select中如何使用CSS?
- 为什么执行java.sql.Blob.getBytes(1,blob.length())时总抛出ArrayIndexOutOfBoundsException?
- 如何在jsp中使用javabean?
- 怎样把javascript 的变量赋予 java变量。
- 为什么我的javax.mail.*、javax.mail.internet.*、javax.mail.activation.*为什么找不到啊
- hibernate 一对多 关联时出错
- my97datepicker支持IE11吗
select p.visacode, p.visaserialno
from ywuser.vs p,
(select p.visacode, p.visaserialno
from ywuser.vs 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');应该不用加吧?
select v.* from vs where v.flag not in ('0','1')
and v.VisaSerialNo not between (select v2.StartSerialNo from vsdossier v2 where v2.visacode = v.visacode) and (select v2.EndSerialNofrom vsdossier v2 where v2.visacode = v.visacode)
第一行vs后面忘加上 as v 了
where startserialno not in(select visaserialno
from ywuser.vs vsm
where vsd.visacode = vsm.visacode
and flag not in ('0', '1'))
and endserialno not in(select visaserialno
from ywuser.vs vsm
where vsd.visacode = vsm.visacode
and p.flag not in ('0', '1'))