How do I do the following...
SELECT A, B, C, SUM(A)
FROM X
I found the following on an Oracle error site...
ORA-00937: not a single-group group function
Cause: A SELECT list cannot include both a group function, such as AVG, COUNT, MAX, MIN, SUM, STDDEV, or VARIANCE, and an individual column expression, unless the individual column expression is included in a GROUP BY clause.
Action: Drop either the group function or the individual column expression from the SELECT list or add a GROUP BY clause that includes all individual column expressions listed.
...which presumably means I need a GROUP BY but I cannot seem to get it right.
I could run this as two queries (SELECT A, B, C ...and... SELECT SUM(A) but it seems a waste.
SELECT A, B, C, SUM(A)
FROM X
I found the following on an Oracle error site...
ORA-00937: not a single-group group function
Cause: A SELECT list cannot include both a group function, such as AVG, COUNT, MAX, MIN, SUM, STDDEV, or VARIANCE, and an individual column expression, unless the individual column expression is included in a GROUP BY clause.
Action: Drop either the group function or the individual column expression from the SELECT list or add a GROUP BY clause that includes all individual column expressions listed.
...which presumably means I need a GROUP BY but I cannot seem to get it right.
I could run this as two queries (SELECT A, B, C ...and... SELECT SUM(A) but it seems a waste.