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