i have a table and i have little issue with groupby month
CREATE TABLE BabyData (BabyId INT, BabyName TEXT, _id INT PRIMARY KEY, Date DATE, Height TEXT, Weight TEXT);
from this table i want the average of weight in each month in a year
when i am providing a date as ‘2011-2-2’ then i want the average of weight in each month from
‘2011-2-2’ to ‘2012-2-2’
i gave like this
SELECT strftime('%Y',Date) AS year,
strftime('%m',Date) AS month,
Avg(Weight) As Amount
FROM BabyData
Group By strftime('%Y',Date),strftime('%m',Date)
But i getting only 1 average
1 Answer