Looking for a bit of help.
I am receiving the below error when trying to count the results of a case statement involving a sum.
I am trying to find some workaround as I know this is not the correct way to do it but I am totally stumped.
In English I want to:
Count the amount of orders that has a total item quantity of 1.
The SQL I am using is:
,COUNT(CASE
WHEN SUM(delivery_line_item.dli_qty) = 1 THEN
1
ELSE
0
END)
AS SingleLineOrders
Without the Count statement, the query returns the result of 1, where I need to count all instances where the sum of dli_qty = 1.
Hopefully someone can help 🙂
Thanks
Justin Arkinson is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.