#表是这样的
id name
1 a
2 b
3 c
4 c
5 b
-- 这样写就报错了,distinct得放到数据项目的开头
select id, distinct name from table
-- 这样写是可以的
select *, count(distinct name) from table group by name
SQL, 错误, distinct, 数据项目, group by
文章讨论了SQL查询中使用DISTINCT的正确位置,强调了DISTINCT应放在SELECT语句的开头,并给出了正确和错误的示例。