Screen Link: https://app.dataquest.io/m/190/building-and-organizing-complex-queries/8/challenge-each-countrys-best-customer
My Code: ’
WITH
customer_purchases AS
(
SELECT
cu.country AS country,
cu.first_name || " " || cu.last_name AS customer_name,
ROUND(SUM(invoice.total) , 2) AS total_purchased
FROM customer AS cu
INNER JOIN invoice ON invoice.customer_id=cu.customer_id
GROUP BY customer_name
ORDER BY 1 ASC , 3 DESC
)
SELECT country,customer_name,
MAX(total_purchased) AS total_purchased
FROM customer_purchases
GROUP BY country;
What actually happened: When I ran my code, my result was the same as the result that It should be, but when I submit it, I see this (The value for the result doesn’t look right.)