Question
SQL- Getting Subtotal From a Query
Hi,
I need to run a query where I can get a subtotal for each items in a table. The query should produce something like:
3 apple
4 grape
1 orange
I did a SUM and COUNT function but, I get the total records (8) in the table instead of the subtotals.
SELECT id, SUM(fruit) AS Total
FROM table
WHERE ORDER BY fruit
Any suggestions would be great.
Thanks,
Jenn
