sql001

原查询结果如下:

要求实现如下

sql语句如下:

select case when  rnum in
 (
 select to_char(min(rnum)) as rnum from (  select rownum as rnum, jh,kgrq,rq from 表名 
     where jh='9L116-05' and kgrq=to_date('2000-1-16','yyyy-mm-dd') order by rq)
     group by rq
 ) then to_char(rq,'yyyy-mm-dd')   else ''  end as rq ,kgrq,jh from  
  (select rownum as rnum, jh,kgrq,rq from 表名 
     where jh='9L116-05' and kgrq=to_date('2000-1-16','yyyy-mm-dd') order by rq)

 

实现效果如下:

posted @ 2011-10-25 10:40  居后不争  阅读(575)  评论(0编辑  收藏  举报