中国开发网: 论坛: 程序员情感CBD: 贴子 389592
wynnhjg
如何写?
偶没有在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

相关信息:


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