SELECT c.COUNTRY_ID,COUNT(d.DEPARTMENT_ID)
FROM countries AS c
JOIN
locations AS l
ON l.COUNTRY_ID= c.COUNTRY_ID
JOIN
departments AS d
ON d.LOCATION_ID = l.LOCATION_ID
GROUP BY c.COUNTRY_ID;
SELECT c.COUNTRY_ID,COUNT(d.DEPARTMENT_ID)
FROM countries AS c
JOIN
locations AS l
ON l.COUNTRY_ID= c.COUNTRY_ID
JOIN
departments AS d
ON d.LOCATION_ID = l.LOCATION_ID
GROUP BY c.COUNTRY_ID;
Add your comment