Say you have table of some items with these two columns:
- ItemName
- Price
....where ItemName
is unique.
How do you show sum of all prices for every ItemName
(I'm using Oracle)? If I just try this:
SELECT ItemName,
SUM(Price)
FROM Items
I get this error:
ORA-00937: not a single-group group function
...which goes away only if I use GROUP BY. But then I can SUM only by groups, not all of them.