中国开发网: 论坛: 程序员情感CBD: 贴子 389426
wynnhjg
SQL都熟悉者入.
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号的数据没有了,如何搞定?

相关信息:


欢迎光临本社区,您还没有登录,不能发贴子。请在 这里登录