select '25岁以及上' age_cnt, count(1) Number from user_profile where ifnull(age, 0) >= 25 union all select '25岁以下', count(1) from user_profile where ifnull(age, 0) < 25 order by Number desc;重点:判断为空则取0,是用ifnull函数(oracle是nvl函数)。