count distinct groupby 小记录
1 select * from t_um_user 2 --2204 3 select count(*) from t_um_user 4 --2204 5 6 select name from t_um_user --包含null 7 --2204 8 select count(name) from t_um_user --排除null(6个) 9 --2198 10 11 select distinct name from t_um_user --包含null 12 --1973 13 select count(distinct name) from t_um_user --排除null 14 --1972 15 16 select name from t_um_user group by name 17 --1973 18 select name,count(name) as iCount from t_um_user group by name--name包含null,但count(name)不包含null 19 --1973(name为null的那一行,iCount=0) 20 select name,count(*) as iCount from t_um_user group by name--name包含null 21 --1973(name为null的那一行,iCount=6) 22 =============================================== 23 --表t_user只有name一个字段 24 select name from t_user 25 --2204 26 select count(name) from t_user --排除null 27 --2198 28 select count(*) from t_user --包含null 29 --2204(虽然*看起来等于name,但算出来的结果就是不一样)