0

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()

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.