Answer the question
In order to leave comments, you need to log in
How to do it in one request?
there are 3 requests, how do i turn them into one?
a) select countries.name, count(camps.id) from countries join camps on countries.id = camps.region_id
b) select regions.name, count(camps.id) from regions join camps on regions.id = camps.region_id
c) select cities.name, count(camps.id) from cities join camps on cities.id = camps.region_id
Answer the question
In order to leave comments, you need to log in
select countries.name, regions.name, cities.name, count(camps.id) from camps
inner join countries on countries.id = camps.region_id
inner join regions on regions.id = camps.region_id
inner join cities on cities.id = camps.region_id
group by countries.name, regions.name, cities.name
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question