postgraph
postgraph copied to clipboard
Add DISTINCT to GROUP BY
If these duplicates are undesirable, they can be removed using the DISTINCT clause directly on the GROUP BY. Therefore:
GROUP BY DISTINCT ROLLUP (a, b), ROLLUP (a, c)
is equivalent to
GROUP BY GROUPING SETS (
(a, b, c),
(a, b),
(a, c),
(a),
()
)