Summing up a total for a Year Hi,
Seem to be getting stuck, I think there is an easy way to do what I
want, I have just not found it yet.
I have data for 10 years, I am looking to get a SUM of a field for a
particular year.
For example:
SELECT SUM(ounces) as ounces
FROM beverages
give me back one result, the total ounces for all 10 years.
If I do this:
SELECT date, SUM(ounces) as ounces
FROM beverages
WHERE YEAR(date) = 1998
GROUP BY date
ORDER BY date DESC
I get back multiple rows for the year 1998, when I really only want
the one value that is the total SUM for all ounces during the year
1998.
beverages has 4 fields, location, date, ounces and type.
thanks for any help!
O |