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.

SELECT City, COUNT(Name) AS Population_number
FROM Person
GROUP BY City
ORDER BY Population_number DESC LIMIT 1

Thank you very much ;)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.