5つ以上の都市を持つ国を引き抜こうとしています。グループSQLステートメント - 都市が5つ以上ある国を取得する
テーブル:
市city_id, city, country_id, last_update
国country_id, country, last_update
私はこれが考え出し得るために非常に近いと思うが、私はかなりありませんよ。すべてのポインタ?
SELECT DISTINCT country
FROM country C, city O
WHERE O.country_id = C.country_id AND O.country_id
IN (SELECT country_id FROM city group by country_id having count(country_id) > 5);
この記事をお読みください。 http://sqlblog.com/blogs/aaron_bertrand/archive/2009/10/08/bad-habits-to-kick-using-old-style-joins.aspx –