mirror of
https://github.com/hanzo-ds/sqlparser.git
synced 2026-10-30 20:53:50 +00:00
27 lines
507 B
SQL
27 lines
507 B
SQL
-- Origin SQL:
|
|
SELECT
|
|
datacenter,
|
|
distro,
|
|
SUM (quantity) AS qty
|
|
FROM
|
|
servers
|
|
GROUP BY
|
|
GROUPING SETS(
|
|
(datacenter,distro),
|
|
(datacenter),
|
|
(distro),
|
|
()
|
|
);
|
|
|
|
SELECT
|
|
datacenter,
|
|
distro,
|
|
SUM (quantity) AS qty
|
|
FROM
|
|
servers
|
|
GROUP BY ALL;
|
|
|
|
-- Format SQL:
|
|
SELECT datacenter, distro, SUM(quantity) AS qty FROM servers GROUP BY GROUPING SETS((datacenter, distro), (datacenter), (distro), ());
|
|
SELECT datacenter, distro, SUM(quantity) AS qty FROM servers GROUP BY ALL;
|