MySql supports GROUP BY WITH ROLLUP, which will return aggregates for the last x of n columns in a group, but does not support GROUP BY WITH CUBE to accept all combinations of n columns and accept aggregates.
I can simulate this by combining GROUP BY WITH ROLLUP queries, but MySql implements my subquery many times. I use the group in a large subquery, so this is suboptimal. Is there a way to solve this problem without temporary tables?
source share