select user_id from ( select user_id, count(*) qs_cnt, -- 统计提交次数 count(if(result_info = 1,result_info,null)) right_cnt -- 统计正确次数 from done_questions_record group by user_id having qs_cnt > 2 and right_cnt > 2 -- 提交次数和正确次数都大于2 order by user_id ) temp
select user_id from ( select user_id, count(*) qs_cnt, -- 统计提交次数 count(if(result_info = 1,result_info,null)) right_cnt -- 统计正确次数 from done_questions_record group by user_id having qs_cnt > 2 and right_cnt > 2 -- 提交次数和正确次数都大于2 order by user_id ) temp