我有以下(MySQL)表名为“sls_ord”:
Sales Total Date
joko susilo Rp. 12.000.000; 24-May-2013
wenini Rp. 13.000.000; 25-May-2013
Supardjo Rp. 13.300.000; 20-May-2013
wenini Rp. 20.300.000; 6-May-2013
joko susilo Rp. 23.300.000; 8-May-2013
joko susilo Rp. 24.000.000; 1-May-2013
如何计算和分组销售额,按周计算?
另外1个问题请帮帮我,如何在下周自动显示数据???
答案 0 :(得分:3)
select sales,
yearweek(date) as week_date,
sum(total) as week_total
from sls_ord
group by sales, yearweek(date)
我认为你的意思是总和而不是计算。