SELECT a.id as app_id, a.name as app_name, count(q.id) as qcount, r.avg_time_spent as avg_time, r.avg_score as avg_score, r.total_exams_taken FROM linen_ex_apps a LEFT JOIN linen_questions q ON q.ex_app_id = a.id LEFT JOIN linen_ex_app_agg_results r ON r.ex_app_id = a.id WHERE a.active = 1 AND a.section_id = 23 GROUP BY a.id LIMIT 0, 10