[阅读: 459] 2006-09-04 09:12:12
偶没有在SQL里干过?你在里面写写看.
select A.TheDate, A.pjz Today, C.pjz Yesterday
from (select distinct TJ_RSJ.rq TheDate, TJ_RSJ.Pjz
from 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 hh = '17025274'
and SJBH = '9010') A
left join (select TJ_RSJ.Rq+1 as TheDate, TJ_RSJ.pjz
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')
and hh = '17025274'
and SJBH = '9010') C on A.TheDate = C.TheDate
order by A.TheDate desc