Skip to content
Advertisement

How to do query with multiple condition from 2 table?

I wanna pick cities from worldcity by these conditions:

  • the population of the city exceeds the population of the most populous city in the Filipina. (Meaning: for example city X is the city in the Filipina with the most population. We want to list the cities with a population greater than city X), AND
  • there is a city in the United States (uscity) with the same city name as the selected cities

OperationalError: near “population”: syntax error

Advertisement

Answer

Adjust the WHERE clause to place the MAX inside the subquery:

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement