WITH customer_country_purchases AS
c.first_name || " " || c.last_name as customer_name,
round(SUM(i.total), 2) total_purchases
FROM invoice i
ON c.customer_id = i.customer_id
GROUP BY 1,2
ORDER BY 1),
GROUP BY 1)
country, customer_name, total_purchased
ORDER BY 1
What I expected to happen:
i thought this would return the correct answer and it did.
What actually happened:
but im getting the message that the value isnt quite right.
i need help figuring out what im doing wrong.
Hi @rayolufadeju, your code is correct but it is not accepted because the suggested answer does not ROUND up the total_purchased column. Remove the ROUND function from the line below and the answer is accepted.
> round(SUM(i.total), 2) total_purchases
Interestingly, I only added the ROUND function because I kept getting errors.
I looked at other posts with the same problem and tried to fix it myself.
I noticed many people didn’t get the GROUP BY correctly, so I adjusted that.
must have forgotten to remove the ROUND.
I’ll go back and re-examine my code.
Thanks for your help.