Link to home
Start Free TrialLog in
Avatar of Morpheus7
Morpheus7

asked on

Averaging yearly data

Hi,

I have a table that contains monthly averages as follows:

Date(Datetime) fat_percent(Float), oil_percent(Float), MSG_Percent(Float), Quantity(INT).

For each year there are 12 entries. I would like to be able to calculate an average for each year.
The table hold 15 years of data, so I would like to return a row for each year with the with the values for each column.

Any help would be appreciated.

Thanks
Avatar of Vitor Montalvão
Vitor Montalvão
Flag of Switzerland image

Can you post sample data?
Some rows with actual data and the expected result.
ASKER CERTIFIED SOLUTION
Avatar of Phillip Burton
Phillip Burton

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
something like this?

select YEAR(Date), SUM(fat_percent), SUM(oil_percent), sum(MSG_Percent), sum(Quantity)
from your tablename
group by YEAR(Date)
Order by 1
a minute too late!
Avatar of Phillip Burton
Phillip Burton

And it should be Avg, not Sum