distinct与NULL在count的注意事项
select * from errorinfo select count(1) from errorinfo select distinct info from errorinfo select count(distinct info) from errorinfo
distinct 会将所有NULL合并为一项
count(distinct)会将NULL除去。
select count(distinct info), info from errorinfo group by info
null不参与count运算,同样适用于sum, avg。
distinct时,所有null作为一个值。