[mysql] Select first 10 distinct rows in mysql

Is there any way in MySQL to get the first 10 distinct rows of a table.

i.e. Something like...

SELECT TOP 10 distinct * 
FROM people 
WHERE names='SMITH'
ORDER BY names asc

However this method doesn't actually work, because it gives the error: "Syntax Error. Missing operator in query expression distinct *"

This question is related to mysql

The answer is


Try this SELECT DISTINCT 10 * ...


SELECT * 
FROM people 
WHERE names ='SMITH'
ORDER BY names asc
limit 10

If you need add group by clause. If you search Smith you would have to sort on something else.