with user AS( select uid from user_info where level="6" or level="7" ) SELECT u.uid, COUNT(DISTINCT DATE_FORMAT(er.start_time,'%Y%m')) count(DISTINCT DATE_FORMAT(pr.submit_time,'%Y%m')) COUNT(DISTINCT case when DATE_FORMAT(er.start_time,'%Y%m')=DATE_FORMAT(pr.submit_time,'%Y%m') THEN 1 end) AS ac...