sql >> Base de Datos >  >> RDS >> Mysql

Obtener el Top 3 de la tabla Mysql según la Condición/Valor

Bueno, puedes probar este conjunto de consultas:

(SELECT Name, PositionId, TScore FROM Soccerplayers WHERE PositionID = 1 ORDER BY TScore LIMIT 3)
UNION
(SELECT Name, PositionId, TScore FROM Soccerplayers WHERE PositionID = 2 ORDER BY TScore LIMIT 4)
UNION
(SELECT Name, PositionId, TScore FROM Soccerplayers WHERE PositionID = 3 ORDER BY TScore LIMIT 3)