← 返回文章列表

mysql之distinct与group_by

distinct

select distinct name from user;

group by

select * from user group by  name;

PS: 对于经过 group 后的条件筛选使用 having (where 作用与 group 前)