less than 1 minute read

Problem

problem-586

My Query

SELECT t.customer_number
FROM (
    SELECT customer_number, COUNT(*) as total
    FROM Orders
    GROUP BY customer_number
    ORDER BY total DESC
    LIMIT 1
) AS t

Editorial Solution

SELECT
    customer_number
FROM
    orders
GROUP BY customer_number
ORDER BY COUNT(*) DESC
LIMIT 1
;

Tags:

Updated: