板邓:MYSQL distinct关键字查询重复值只显示一条记录
正确语句:
select *, count(distinct name) from table group by name
错误语句:
select id, distinct name from table
很遗憾,除了错误信息你什么也得不到,distinct必须放在开头。难到不能把distinct放到where条件里?试试,照样报错。
个人博客:http://www.qbeee.cn
正确语句:
select *, count(distinct name) from table group by name
错误语句:
select id, distinct name from table
很遗憾,除了错误信息你什么也得不到,distinct必须放在开头。难到不能把distinct放到where条件里?试试,照样报错。