SELECT s.* FROM staff s LEFT JOIN team_staff ON team_staff_staff_id = staff_id LEFT JOIN team ON team_staff_team_id = team_id WHERE staff_published = '1' GROUP BY s.staff_id ORDER BY staff_ordering