日期:2014-05-17 浏览次数:21183 次
with tb as( select 12 ID, 'D203456700' A, '2012-03-19 10:08:01' Time1,'2012-03-19 10:10:01' Time2 from dual union all select 11, 'D203456600' ,'2012-03-19 10:06:01' ,'2012-03-19 10:08:01' from dual union all select 9 ,'D203456500' ,'2012-03-19 10:04:01' ,'2012-03-19 10:06:01' from dual union all select 8 ,'D203456300' ,'2012-03-19 10:02:01' ,'2012-03-19 10:04:01' from dual) select prior to_date(time2,'yyyy-mm-dd hh24:mi:ss')- to_date(time1,'yyyy-mm-dd hh24:mi:ss') from tb start with Time2='2012-03-19 10:10:01' connect by Time2=prior Time1
------解决方案--------------------