Is this a join? Somebody point me in the right direction plz
Posted: Thu Jul 13, 2006 12:31 pm
I have a table called county_info that looks like:
id, name
and another table called county_boundaries that looks like
id, county_id, lat, lon, extra_info
There are 4 records in county info, and I need to select all from the second table where county_id is equal to any of the county_info ids. How would I do this?
EDIT: OK, I got this:
But I was hoping to return the information in this format:
id, name
and another table called county_boundaries that looks like
id, county_id, lat, lon, extra_info
There are 4 records in county info, and I need to select all from the second table where county_id is equal to any of the county_info ids. How would I do this?
EDIT: OK, I got this:
Code: Select all
SELECT * FROM `county_boundaries`, `county_info` WHERE county_info.id = county_boundaries.county_idCode: Select all
Array
(
[Tehema] => Array
(
[0] => Array
(
[id] => 8
[lat] => "-0.122220241240514E+03"
[lon] => "0.401418265246914E+02"
)
[1] => Array
(
[id] => 8
[lat] => "-0.122220241240514E+03"
[lon] => "0.401418265246914E+02"
)
[2] => Array
(
[id] => 8
[lat] => "-0.122220241240514E+03"
[lon] => "0.401418265246914E+02"
)
)
[Butte] => Array
(
[0] => Array
(
[id] => 10
[lat] => "-0.122220241240514E+03"
[lon] => "0.401418265246914E+02"
)
[1] => Array
(
[id] => 10
[lat] => "-0.122220241240514E+03"
[lon] => "0.401418265246914E+02"
)
[2] => Array
(
[id] => 10
[lat] => "-0.122220241240514E+03"
[lon] => "0.401418265246914E+02"
)
)