Advertisement
Guest User

Untitled

a guest
Nov 26th, 2015
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQL 0.33 KB | None | 0 0
  1. WITH countries_with_cities AS (
  2.     SELECT countries.name country, COUNT(cities) count_of_cities_25
  3.     FROM countries
  4.     INNER JOIN cities ON cities.country_id = countries.id
  5.     GROUP BY countries.name
  6. ), SELECT COUNT(people) count_of_people_30
  7.     FROM people
  8.     INNER JOIN countries_with_cities ON ? = people.city_id
  9.     GROUP BY people.name;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement