Why not? How else would you aggregate revenue over several dimensions?

- Total revenue, revenue per business unit, revenue per sales employee: ROLLUP - Total revenue, revenue per business unit, revenue per country, revenue per country and business unit: CUBE

The same can be achieved with lots of UNION ALL repetition, as explained in that SQL Server page.

Of course I have nothing against such shorthands but since these do so many things "under the cover" their exact functionality is hard to remember for the user and might produce results that are not really needed in many cases.

I would prefer the more explicit version Eg.

SELECT 'Total' AS TITLE, SUM(revenue) AS THE_SUM FROM T1
UNION
SELECT 'Per Business Unit / ' || BUSINESS_UNIT_NAME AS TITLE, SUM(revenue) AS THE_SUM FROM T1 GROUP BY BUSINESS_UNIT_ID
UNION
...

But this is clearly a matter of preference.

- Rami

--
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at http://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.

Reply via email to