SELECT NULL AS 'country_id', '' AS 'country', COUNT(rider.user_id) AS 'count' FROM user JOIN rider ON user.user_id = rider.user_id WHERE country_id IS NULL OR country_id = '' AND (u.user_id in (SELECT rider_id FROM `comp-rider` group by rider_id) OR `last_login` > `member_since`) GROUP BY 'country'