My result is Correct but It was not accepted

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

Yeah, it’s an unfortunately minor thing but don’t round the values. Just use SUM(invoice.total) without ROUND() and it should pass.

They do say -

however, when running your query, don’t worry about rounding the total_purchased column.

But they should be more specific here.

1 Like