distinct 查詢某個字段不重復記錄
- distinct必須放在第一個位置。若放到后面是會報錯的。
- 若要指定某個字段的distinct,需要以該字段group by 再加上一個count(distinct name);
- group by 必須放在 order by 和 limit之前,不然會報錯
select *, count(distinct name) from table group by name
參考文獻:https://blog.csdn.net/qq_24520119/article/details/52310691