Briefer way of solving

Much briefer way of solving

SELECT
    c.country,
    c.first_name || " " || c.last_name customer_name, 
    MAX(i.total) total_purchased
FROM customer c

INNER JOIN  
   (
    SELECT
        customer_id,
        SUM(total) total
        FROM invoice
        GROUP BY 1
    ) i ON i.customer_id = c.customer_id
GROUP BY 1
ORDER BY 1;

Hi @jonathan.s.spratt:

Here are some guidelines that you may find useful not only in asking questions but also sharing an alternative solution. Please provide a question link and format your code accordingly.

That’s what I was looking for! Much appreciated

1 Like

No worries @jonathan.s.spratt!