SELECT B.*
FROM BigTable AS B -- Why do SQL questions omit the table names so often?
JOIN (SELECT EAN, MIN(Price) AS Price
FROM BigTable
GROUP BY EAN
) AS P
ON B.EAN = P.EAN AND B.Price = P.Price
ORDER BY B.EAN;
Underforespørgslen finder minimumsprisen for hver EAN; den ydre forespørgsel finder de detaljer, der matcher EAN og minimumsprisen for den EAN. Hvis der er to poster med samme minimumspris for en given EAN, vil begge blive valgt.