[阅读: 541] 2006-09-04 07:33:40
select TJ_RSJ.hh,TJ_RSJ.rq,TJ_RSJ.pjz jtpjz,ztpjz.ztpjz
from (select hh,rq,pjz ztpjz from TJ_RSJ
where TJ_RSJ.RQ between to_date('2006-07-25', 'yyyy-mm-dd')-1 and
to_date('2006-07-31', 'yyyy-mm-dd')-1
and hh = '17025274'
and SJBH='9010'
order by rq) ztpjz,TJ_RSJ
where TJ_RSJ.RQ between to_date('2006-07-25', 'yyyy-mm-dd') and
to_date('2006-07-31', 'yyyy-mm-dd')
and TJ_RSJ.hh='17025274'
and SJBH='9010'
and TJ_RSJ.rq-1=ztpjz.rq
order by TJ_RSJ.rq
这个查询是查某一段时间当天的数据,和昨天的数据.
在DB里,是没有29号的数据的,导致查出来以后,30号的数据没有了,如何搞定?