SELECT stat.pg_id, SUM(stat.view_cou) as view_cou, n.* FROM `popnano_stat`.reit_www_daily as stat LEFT OUTER JOIN `popnano`.trade as n ON n.id = stat.pg_id WHERE stat.pg_grp='5' AND (stat.y >= 2019 AND stat.m >= 4 AND stat.d >= 15) AND (stat.y <= 2019 AND stat.m <= 4 AND stat.d <= 21) GROUP BY stat.pg_id ORDER BY view_cou DESC, stat.ip_cou DESC LIMIT 0, 10