1

SQLでは、countryのような列でGROUP BY関数を使用できますか?(これはchar / varcharになります)

SELECT country, population, COUNT(*) AS count_cities
FROM list_of_cities
GROUP BY country;

これを書くためのより良い方法は何でしょうか?

4

1 に答える 1

3
SELECT country, SUM(population) AS country_population, COUNT(*) AS count_cities 
FROM list_of_cities 
GROUP BY country;
于 2013-01-12T01:30:22.713 に答える