Reputation: 3
I got this error:
your query does not include the specified expression as part of an aggregate function
When i tried to execute this:
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()
Upvotes: 0
Views: 49
Reputation: 58
Sum is an Aggregate Function so all the Other fields which are been called in the query must be used in Group by clause. this may resolve the issue.
Upvotes: 1