when run following query,
select nvl(week, 'sum) week , sum(a) a, sum(b) b ( select b.* table b b.week between '2013051' , '2013052' ) group rollup(week)
i data
| week | 2013051 2013052
but want data named below.
| week | 2013. 05. 1 week 2013. 05. 2 week
can me fixing this?
assuming week
string:
select substr(week, 1, 4) ||'. '|| substr(week, 5, 2) ||'. '|| substr(week, 7, 1) ||' week' week, ...
or if week
can null (which can't data because of subquery's filter, generated null value rollup
missed):
select case when week null 'sum' else substr(week, 1, 4) ||'. '|| substr(week, 5, 2) ||'. '|| substr(week, 7, 1) ||' week' end week, ... week b ---------------- ---------- ---------- 2013. 05. 1 week 1 2 2013. 05. 2 week 3 4 sum 4 6
sql fiddle demo; , 1 without subquery, seems superfluous here.
Comments
Post a Comment