x在传统关系型数据库中,group by与count(distinct)都是很常见的操作.count(distinct colA)就是将colA中所有出现过的不同值取出来,相信只要接触过数据库的同学都能明白什么意思. count(distinct colA)的操作也可以用group by的方式完成,具体代码如下: select count(distinct colA) from table1; select count(1) from (select colA from table1 group…