我收到了这个错误:
您的查询不包含指定的表达式作为一部分 聚合函数
当我试图执行此操作时:
SELECT DISTINCT invoice_details.item,
SUM((invoice_details.cartoons * products.punits) + invoice_details.units) as units,
SUM(invoice_details.total) as total
FROM invoice_details, products, invoices
WHERE invoices.invoice_id = invoice_details.invoice_id
and products.pname = invoice_details.item
and format(invoices.create_date, "d/mm/yyyy") = DATE()
答案 0 :(得分:1)
Sum是一个聚合函数,因此必须在Group by子句中使用查询中调用的所有Other字段。这可能会解决问题。