Question:
I am trying to write a select statement that 1) calculates a yearly
total (ok doing this) but then displays a monthly totals with the
highest total at the top> Here is what i have.
select sale_date, sum(sale_qty) from daily_sales
where to_char(sale_date, 'MM') < 13
but I get this error --ERROR at line 1:
ORA-00937: not a single-group group function
Answer:
select sale_date, sum(sale_qty) from daily_sales
where to_char(sale_date, 'MM') < 13
group by sale_date;