DBAsupport.com Forums - Powered by vBulletin
Results 1 to 5 of 5

Thread: Rollup

Threaded View

  1. #3
    Join Date
    Sep 2001
    Location
    Düsseldorf, Germany.
    Posts
    588
    Though this is not in the same format as you expect, but gives the required result... Individual total, total on days and grand total..

    Code:
    SQL>l
      1  SELECT subscriber_name,
      2  DECODE(to_char(datum,'D'),1,'Mon',2,'Tue',3,'Wed',4,'Thu',5,'Fri',6,'Sat',7,'Sun', 'To
      3  SUM(hours) hours
      4  FROM subscriber
      5* GROUP BY CUBE (subscriber_name, to_char(datum,'D'))
    SQL> /
    
    SUBSCRIBER DAY         HOURS
    ---------- ------ ----------
    Joe        Mon             8
               Tue             2
               Wed             3
               Thu             7
               Fri             4
               Sat             8
               Sun             1
               Total          33
    
    John       Mon             2
               Tue             5
               Wed             3
               Thu             7
               Fri             1
               Sat             9
               Sun             4
               Total          31
    
    Lis        Mon            15
               Tue             1
               Wed            13
               Thu             8
               Fri             2
               Sat            17
               Sun             3
               Total          59
    
    Martin     Mon             5
               Tue             1
               Wed             3
               Thu             8
               Fri             2
               Sat             7
               Sun             3
               Total          29
    
               Mon            30
               Tue             9
               Wed            22
               Thu            30
               Fri             9
               Sat            41
               Sun            11
    
               Total         152
    
    
    40 rows selected.
    
    SQL>
    Sameer
    Last edited by Sameer; 11-08-2002 at 07:52 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width