mysql - How to retrieve multiple rows with the same ID from two tables with only knowing one value -
i sitting @ problem currently. have imported open source geolocation database.
i have 2 tables want access to.
table a:
id | lat | lon
200 | 48 | 12
table b:
id | type | value
200 | city | munich
200 | state | bavaria
want have result this:
id | lat | lon | typevalue | typevalue
200 | 48 | 12 | munich | bavaria
is possible in 1 query?
edit: value know "munich"
edit2: i've got far:
select geodb_coordinates.lat lat, geodb_coordinates.lon lon, geodb_textdata.text_val text geodb_coordinates, geodb_textdata geodb_coordinates.loc_id = geodb_textdata.loc_id , geodb_textdata.text_val :location group geodb_textdata.text_val order length(geodb_textdata.text_val) limit 3
try like:
select a.id,a.iat, a.ion, b.value typevalue1, c.value typevalue2 inner join b on a.id=b.id , b.type='city' inner join b c on b.id=c.id , c.type='state'
Comments
Post a Comment