Rollup with two columns : ROLLUP « Analytical Functions « Oracle PL/SQL Tutorial






SQL>
SQL>
SQL> select owner, tablespace_name, sum(bytes)/(1024*1024) total_meg
  2  from dba_extents
  3  where rownum < 50
  4  group by rollup (owner,tablespace_name)
  5  /

OWNER                          TABLESPACE_NAME                 TOTAL_MEG
------------------------------ ------------------------------ ----------
SYS                            SYSTEM                                  4
SYS                                                                    4
                                                                       4

SQL>








16.24.ROLLUP
16.24.1.Using the ROLLUP Clause
16.24.2.Passing Multiple Columns to ROLLUP
16.24.3.Changing the Position of Columns Passed to ROLLUP
16.24.4.Uses AVG() with ROLLUP
16.24.5.Using a Column Multiple Times in a GROUP BY Clause
16.24.6.The ROLLUP function was provided to conveniently give the sum on the aggregate.
16.24.7.A two-dimensional grouping with ROLLUP
16.24.8.A SUM using ROLLUP.
16.24.9.Rollup with two columns
16.24.10.Case with grouping and rollup
16.24.11.Count employees, group by ROLLUP(department no, job title)
16.24.12.group by ROLLUP(department no, job title)