用IsNull(yourField,0)代替yourField select id,count(*) from table_name where ifnull(id,'')!='' group by channel_id;