Group Sales by Month Query
Posted on August 15, 2013 at 10:16am
Im trying to design a SQL query to display all added sales from a partner_id grouped by month.
So I have this so far but im having trouble with the sql syntax. Ive tried month(date), ive tried datepart(mm,date), ive tried date_format(date) and datename(date) but they all return sql error function does not exist in iReport Designer
SELECT SUM(account_invoice.amount_total), MONTH(account_invoice.create_date)MONTH FROM account_invoice WHERE account_invoice.partner_id = 837 GROUP BY MONTH(account_invoice.create_date)
Posted on August 16, 2013 at 3:13am
What is your source i.e.Oracle, Sqlsever, file etc., you should use database specific functions to take month part out of date.
Example: Oracle : to_char('account_invoice.create_date','MONTH')
then group by month.
Posted on August 15, 2013 at 11:46am
Doesn't look legit.
Posted on August 15, 2013 at 7:20pm
yeah, like i said, neither works. What Im trying to find out is what would work?