Mysql
 sql >> Base de Dados >  >> RDS >> Mysql

Obtendo o Top 3 da tabela Mysql com base na condição/valor


Bem, você pode tentar 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)