现在将完整语句放出:
.....
select *, count(distinct name) from table group by name
结果:
id name count(distinct name)
1 a 1
2 b 1
3 c 1
group by 必须放在 order by 和 limit之前,不然会报错。。。。。。。。!OK了
转载请注明:谷谷点程序 » Mysql distinct 去重只获取一个值