Why can't I use GROUP BY clause normally like everywhere else?
Query Error: Improper usage of GROUP BY clause.
Please ensure that all non-aggregate columns used in the SELECT clause are also used in GROUP BY clause.
I have a simple table with data scattered around for same value, I want to get the total for all the individual unique values and I can't seem to do this simple thing due to the "Improper use of GROUP BY" which is proper and worked well for years in other SQL programs I've used.
My data,
Product
| Company
| Customer
| Value
|
Apple
| ABC | John | 12 |
Orange | ABC | Smith | 30 |
Grapes | DEF | Will | 9 |
Apple | DEF | Steve | 8 |
Orange | DEF | Tom | 19 |
Orange | KLM | Jenny | 13 |
Orange | KLM | Matt | 3 |
I want to get the total of all the products,
Apple : 20
Grapes : 9
Orange : 65
what will be the correct way to use the GROUP BY when using SUM(Product) ?