板邓:MYSQL distinct关键字查询重复值只显示一条记录

 

正确语句:

select *, count(distinct name) from table group by name

错误语句:

select id, distinct name from table
很遗憾,除了错误信息你什么也得不到,distinct必须放在开头。难到不能把distinct放到where条件里?试试,照样报错。

posted @ 2017-06-13 18:02  贵隆  阅读(400)  评论(0编辑  收藏  举报