select t5.psr_id,t5.times as time,
t4.VA,t4.VB,t4.VC,t4.AMP1,t4.AMP2,t4.AMP3,
t4.INSTW,t4.INSTVAR ,t4.FWDTOTW ,t4.VOLAMPR ,
t4.TOTVAR,t4.CT,t4.PT
from (
select t2.psr_id,t1.times from (
select to_char(to_date(t.dates,'yyyy-mm-dd')+(rownum -1)/96,'yyyy-mm-dd hh24:mi') times from
(select distinct substr(time,0,10) dates from test where rownum = 1) t
connect by rownum <=96) t1,
(select distinct PSR_ID from test) t2) t5,
(select * from (
select PSR_ID,to_char(to_date(TIME,'yyyy-mm-dd hh24:mi'),'yyyy-mm-dd hh24:mi') time,VA,VB,VC,AMP1,AMP2,AMP3,INSTW,INSTVAR ,FWDTOTW,VOLAMPR,TOTVAR,CT,PT,row_number() over(partition by psr_id,time order by va) cnt from test
) t3 where cnt=1) t4
where t5.psr_id=t4.psr_id(+)
and t5.times = t4.time(+)
order by 1,2 |
|