select gender,university, count(device_id) as user_num, round(avg(active_days_within_30),1) as avg_active_day, avg(question_cnt) as avg_question_cnt from user_profile group by university,gender; 第一次写这么复杂的sql,count():统计某字段一共有多少round(num,1):四舍五入group by :分组,后边可以跟好几个。