|
with tb as
(select 1 id ,'2011-09-01' bdate,'2011-09-05' edate,110 proid,10 prc from dual
union all
select 1 id ,'2011-09-03' bdate,'2011-09-07' edate,110 proid,8 prc from dual
union all
select 1 id ,'2011-09-08' bdate,'2011-09-12' edate,119 proid,100 prc from dual
union all
select 1 id ,'2011-09-10' bdate,'2011-09-15' edate,119 proid,80 prc from dual
union all
select 1 id ,'2011-09-20' bdate,'2011-09-25' edate,120 proid,60 prc from dual
)
select proid,min(prc)keep(dense_rank first order by prc)prc
from
(select id,proid,prc, row_number()over(partition by proid order by id)rn from tb)
where rn>=2
group by proid; |
|