MySQL query selecting values from two tables

r00tz

New Member
I have the following two tables:\[code\]Cities: id | name | county_idCounties: id | name\[/code\]I am passing this query a county 'name' and I am trying to select id and name of all rows from cities with the same county_id. I am having difficulty building a query across these two database tables. Here is what I have:\[code\]"SELECT cities.id,cities.nameFROM cities,countiesWHERE counties.name='$county' AND cities.county_id=counties.idORDER BY cities.name ASC";\[/code\]
 
Back
Top