select t1.num,t1.bsh01,t2.bsh01 from (select rownum as num,bshdate,bsh42,bsh01 from cshfjnsz.bsh_file where bsh42 is not null) t1,(select rownum as num,bshdate,bsh42,bsh01 from cshfjnsz.bsh_file where bsh42 is not null) t2 where t1.bsh42 between t2.bshdate and t2.bsh42 and t1.num<100 order by t1.num 這個是我查詢的,日期重合的太多(bshdate,bsh42),加了個限制and t1.num<100 ,你可以換成你的item。
多个不同的ITEM有的ITEM是3条记录 甚至更多记录
select t1.num,t1.bsh01,t2.bsh01 from (select rownum as num,bshdate,bsh42,bsh01 from cshfjnsz.bsh_file
where bsh42 is not null) t1,(select rownum as num,bshdate,bsh42,bsh01 from cshfjnsz.bsh_file
where bsh42 is not null) t2
where t1.bsh42 between t2.bshdate and t2.bsh42
and t1.num<100
order by t1.num
這個是我查詢的,日期重合的太多(bshdate,bsh42),加了個限制and t1.num<100
,你可以換成你的item。
我用lead 解决了