摘要行将位于升序的开头和降序的结尾。请考虑以下示例以更清楚地理解它 -
mysql> Select * from (Select sr, SUM(PRICE) AS PRICE from ratelist GROUP BY sr WITH ROLLUP) AS Price ORDER BY Sr DESC;
+------+-------+
| sr | PRICE |
+------+-------+
| 5 | 250 |
| 4 | 850 |
| 3 | 1005 |
| 2 | 630 |
| 1 | 502 |
| NULL | 3237 |
+------+-------+
6 rows in set (0.00 sec)
mysql> Select * from (Select sr, SUM(PRICE) AS PRICE from ratelist GROUP BY sr WITH ROLLUP) AS Price ORDER BY Sr ASC;
+------+-------+
| sr | PRICE |
+------+-------+
| NULL | 3237 |
| 1 | 502 |
| 2 | 630 |
| 3 | 1005 |
| 4 | 850 |
| 5 | 250 |
+------+-------+
6 rows in set (0.01 sec)
登录后复制
以上就是使用 ROLLUP 修饰符时,是否可以使用 MySQL ORDER BY 子句对结果进行排序?的详细内容,更多请关注每日运维网(www.mryunwei.com)其它相关文章!