我已经使用两个查询更新了以下代码,它们运行正常。
$query1="SELECT sum(sub_total) as limonadeTotal from ucommerce_order_line WHERE part_number = '$part_number' group by MONTH(date_created)";
$query2="SELECT sum(sub_total) as strawberryLimonadeTotal from ucommerce_order_line WHERE part_number = '$part_number' group by MONTH(date_created)";
感谢您的帮助
答案 0 :(得分:0)
试试这个..
使用月份功能对日期的月份进行分组,并且"总和"创建小计总数
select sum(sub_total) as total from ucommerce_order_line group by MONTH(date_created)
REF:http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_month