select CONCAT(wr.first_name," ", wr.last_name) as name, wr.wisport_racer_id, ag.label,ag.age_group_id, wr.gender, t.points\n
                FROM wisport_racers wr\n
                LEFT JOIN wisportResults wp on wr.wisport_racer_id = wp.wisport_racer_id\n
                RIGHT JOIN age_groups ag ON ag.age_group_id = wr.age_group_id\n
                left JOIN totals t on t.wisport_racer_id  = wr.wisport_racer_id\n
                WHERE wr.paid = 1 and t.type = "TT" and t.season_id LIKE '2018%'\n
                GROUP BY wr.wisport_racer_id, wr.age_group_id, wr.gender,wr.first_name, wr.last_name, wr.gender,ag.label,\n
                    t.points, ag.age_group_id\n
                ORDER BY wr.gender ASC, wr.age_group_id ASC, t.points DESC