SELECT *
FROM test s
WHERE
(
SELECT COUNT(*)
FROM test f
WHERE f.name = s.name AND
f.score >= s.score
) <= 2
More Related Contents:
- Using LIMIT within GROUP BY to get N results per group?
- Retrieving the last record in each group – MySQL
- Using ORDER BY and GROUP BY together
- ROW_NUMBER() in MySQL
- Get top n records for each group of grouped results
- Group by clause in mySQL and postgreSQL, why the error in postgreSQL?
- Strange duplicate behavior from GROUP_CONCAT of two LEFT JOINs of GROUP_BYs
- What’s faster, SELECT DISTINCT or GROUP BY in MySQL?
- Select row with most recent date per user
- Mysql query to dynamically convert rows to columns
- MySQL “Group By” and “Order By”
- SELECT / GROUP BY – segments of time (10 seconds, 30 seconds, etc)
- Group mysql query by 15 min intervals
- Get the latest date from grouped MySQL data
- How to get the latest record in each group using GROUP BY? [duplicate]
- SQL Query to get column values that correspond with MAX value of another column?
- MySQL Group By and Sum total value of other column
- Get most recent row for given ID
- Is it possible to GROUP BY multiple columns using MySQL?
- Using Count to find the number of occurrences
- How to select the most recent set of dated records from a mysql table
- MySQL: How do I join same table multiple times?
- GROUP BY – do not group NULL
- Selecting all corresponding fields using MAX and GROUP BY
- SELECT query return 1 row from each group
- MySQL SELECT most frequent by group
- MySQL Group By Hours
- mysql count group by having
- How do I limit the number of rows per field value in SQL?
- SQL query with avg and group by