3 ms·
It's different from distinct. Distinct just eliminates duplicates but does not group entries. Suppose... SELECT brand, model, revision, SUM(quantity) FRO
by genezeta 2y ago
It's different from distinct. Distinct just eliminates duplicates but does not group entries.
Suppose...
SELECT brand, model, revision, SUM(quantity)
FROM stock
GROUP BY brand, model, revision
This is not solved by using distinct as you would not get the correct count.
Group By All allows you to write it a bit more compact...
SELECT brand, model, revision, SUM(quantity)
FROM stock
GROUP BY ALL
- aidos 2y agoGotcha. Thanks. That’s actually super useful! Looks like Postgres doesn’t implement it unfortunately. I revert to “group by 1, 2, 3… “ when I’m just hacking about. Group by all would definitely be an improvement.