Group by .. with rollup having
Taking the example from
http://dev.mysql.com/doc/refman/5.0/en/group-by-modifiers.html
mysql> SELECT year, SUM(profit) FROM sales GROUP BY year WITH ROLLUP;
+------+-------------+
| year | SUM(profit) |
+------+-------------+
| 2000 | 4525 |
| 2001 | 3010 |
| NULL | 7535 |
+------+-------------+
What is the expected behaviour if it is changed to
mysql> SELECT year, SUM(profit) as S FROM sales GROUP BY year WITH ROLLUP HAVING s > 4000;
+------+-------------+
| year | SUM(profit) |
+------+-------------+
| 2000 | 4525 |
| NULL | 7535 |
+------+-------------+
Should it be 4525 or 7535?
I believe I get 7535.
Maybe the exact behaviour on such situation should be documented.
Subject
Views
Written By
Posted
Group by .. with rollup having
29349
August 02, 2006 07:42PM
6431
May 07, 2009 04:06PM
6652
May 20, 2009 09:30AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.