|
-
Rollup
I've asked about this before but have had no success with what was suggested.
I have an sql script that collects stats on our users on a daily basis. The problem I have is that I can get it to add up the columns per day but I need to then be able to add up all the days to give me a weekly total and I don't know how! I have to spend hours doing it in excel, anybody got any ideas??
E.G
Mon Tue Wed Thu Fri Sat Sun
Jones 0 1 2 3 4 5 6
Smith 3 2 0 1 3 1 0
---------------------------
3 3 2 4 7 6 6 I need a grand total of this.
I've tried using rollup as suggested but it doesn't work, just appears to repeat the lines.
This is my sql
break on subscriber skip 1 on username on job on id
compute sum of Monday Tuesday Wednesday Thursday Friday Saturday Sunday on subscriber
select initcap(s.subscriber_name) subscriber
,initcap(su.user_name) username
,su.job_title job
, su.public_id id
, stats_by_week(su.public_id, trunc(sysdate -7)) Monday
, stats_by_week(su.public_id, trunc(sysdate -6)) Tuesday
, stats_by_week(su.public_id, trunc(sysdate -5)) Wednesday
, stats_by_week(su.public_id, trunc(sysdate -4)) Thursday
, stats_by_week(su.public_id, trunc(sysdate -3)) Friday
, stats_by_week(su.public_id, trunc(sysdate -2)) Saturday
, stats_by_week(su.public_id, trunc(sysdate -1)) Sunday
from subscribers s
,subscriber_users su
,security_log sl
where sl.PUBLIC_ID(+) = su.PUBLIC_ID
and su.SUBSCRIBER_ID = s.SUBSCRIBER_ID
and sl.MODULE_REF(+) like 'VIEW%'
and s.subscriber_id!= 1'
group by s.subscriber_name, su.user_name,su.job_title, su.public_id
order by s.subscriber_name
somehow I need to rollup monday - sunday.
Any examples of how to do this would be greatly appreciated.
Thanks, Ali
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|