这么看是没有差别的.使用这两句的目的是不同的.
distinct是将表中的列(age)不重复的列出.
group by 则是将表中的列(age)按值分组.
换两个语句执行就能看出差别了.
select count(distinct age) from employees
select count(age) from employees group by age
distinct是将表中的列(age)不重复的列出.
group by 则是将表中的列(age)按值分组.
换两个语句执行就能看出差别了.
select count(distinct age) from employees
select count(age) from employees group by age
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货