distinct去重

1.COUNT( { [ ALL | DISTINCT ] expression ] | * } )

2.有种比较直接的方法就是把消除重复后在统计查询:

 select count(*) from (select distinct col1 ,col2 , col3 from table)A

3.有种方法比较特别,就是把多个字段的当做一个字段去用于消除重复,比如把这个多个字段的字符串连接起来。如下:

selectcount(DISTINCT fcode+cast(fread_date as varchar(30))) from my_table