-- photographers by number of countries
SELECT u.name, count(distinct countrycode) as countries FROM `photos` p join users u on u.id = p.photographerid group by photographerid order by count(distinct countrycode) desc 