select university , sum(question_cnt)/count(question_cnt) AS avg_question_cnt, sum(answer_cnt)/count(answer_cnt) AS avg_answer_cnt from user_profile group by university having avg_question_cnt<5 or avg_answer_cnt<20;
having的简单应用,对分组后数据进行二次过滤