GROUP BY · SUM

Count copies sold

Which game IDs have the most copies sold?

SQLite
RESULTSReady to run
Compare with the solution

Ritmo de Neón leads with nine copies sold.

SELECT videojuego_id, SUM(unidades) AS unidades_vendidas
FROM lineas_pedido
GROUP BY videojuego_id
ORDER BY unidades_vendidas DESC, videojuego_id ASC;
videojuego_idunidades_vendidas
69
38
13
43
22
51
81