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