select if(AVG(number) is null,'0',number) as newnumber from testtable; AVG求平均值; if(判断条件,满足判断条件时的值,判断的字段)