34,571
社区成员
发帖
与我相关
我的任务
分享
select distinct name from table order by pxh
select distinct name from table order by pxh
不推荐用group by
select name from tb group by name order by min(pxh)
因为,你只是单纯的去重,用distinct就够了,用group by 会增加一遍表的循环。
小数据表,貌似他俩都可以了。但是如果数据有上千万,或者上千万的表去关联其他的表,这个时候就可以知道用distinct效率高的不止一个点了。select name from tb group by name order by min(pxh)