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作爲一個值。