Same answer but "value doesn't look right"

Screen Link:

https://app.dataquest.io/m/190/building-and-organizing-complex-queries/8/challenge-each-countrys-best-customer

WITH customer_country_purchases AS 
    (SELECT 
        c.country country,
        c.first_name || " " || c.last_name as customer_name,
        round(SUM(i.total), 2) total_purchases
    FROM invoice i
    INNER JOIN 
    customer c
    ON c.customer_id = i.customer_id
    GROUP BY 1,2
    ORDER BY 1), 
     
    max_country_purchase AS
    (SELECT
     country,
     customer_name,
     MAX(total_purchases) total_purchased
     FROM customer_country_purchases
     GROUP BY 1)
     
SELECT 
country, customer_name, total_purchased
FROM max_country_purchase
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

image

1 Like

Thank you!
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.

1 Like