0

Hello again! Now i stucked with another little problem.

I have a table:

ID____Name______Age_______City
1_____Robert_____20_______London
2_____Fabio______31_______Rome
3_____Hans______35_______Berlin
5_____Josh_______25_______London

Now i don't know how to get a city which has the most population in this table.
With my code:

SELECT City, COUNT(Name) AS Population_number
FROM Person
GROUP BY City;

I get this result:

City________Population_number

Rome____________1
Berlin____________1
London__________2

But how to get this result:

City_______Population_number

London___________2

To get a city which has the biggest population and output it.
How to filter it?

Thanks for any help in advance.

Edited by Tr1umPr0: /

2
Contributors
2
Replies
3
Views
5 Years
Discussion Span
Last Post by Tr1umPr0
1
SELECT City, COUNT(Name) AS Population_number
FROM Person
GROUP BY City
ORDER BY Population_number DESC LIMIT 1
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.