需要您的帮助 我建立库存和管理库存+发票 我有一张表格“发票”
content: id
customer_name
net_total
paid
due
ordre_date
我想显示每天,一周和几个月的所有net_total
我使用此查询
SELECT *, sum(net_total) as privé
FROM invoice
GROUP BY order_date
但是并不会显示每天的全部净额
答案 0 :(得分:0)
尝试:
SELECT DATE_FORMAT(order_date, '%Y%m%d') AS order_day, sum(net_total) AS privé FROM invoice GROUP BY order_day ORDER by order_day
因为order_date可能是带有小时,分钟...的时间戳,并且您只想按天分组。