选择mysql中的前10个不同的行 [英] Select first 10 distinct rows in mysql

查看:97
本文介绍了选择mysql中的前10个不同的行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

MySQL中是否有任何方法可以获取表的前10个不同的行.

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

即像...

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 *"

推荐答案

SELECT  DISTINCT *
FROM    people
WHERE   names = 'Smith'
ORDER BY
        names
LIMIT 10

这篇关于选择mysql中的前10个不同的行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆