SSHH网络工作室

PLSQL中first_value和last_value取月初,月末

select sid,
       --日期
       sdate,
       --月初
       first_value(rValue) over(partition by sid, substr(sdate, 1, 6) order by sdate) as firstdayofmonth,
       --月末
       last_value(rValue) over(partition by sid, substr(sdate, 1, 6) order by sdate) as lastdayofmonth,
       --当前
       rValue,
  from DataTableName

posted on 2008-08-27 11:00  山虎  阅读(1321)  评论(0编辑  收藏  举报

导航