select count( distinct col1 , col2 , col3 , .......) from table
但是,这样是不允许的,因为count是不能统计多个字段的,虽然distinct是可行的。
有种比较直接的方法就是把消除重复后在统计查询:
select count(*) from (select distinct col1 ,col2 , col3 from table)A
还有一种方法
多个字段用下滑线拼接
select count( distinct col1 +'_'+col2 +'_'+ col3 , .......) from table
个人认为第二种方法比较好