I have a table City with two fields, CityCode and RegionCode I have another table Code with two fields Code and CodeMeaning
I want to write a select statement that will display both cityCode, regionCode and their meanings for each city.
If i had to get one meaning from Code table i could do it with join but i don't know how to get values for both columns.
City Table Data
------------------------
CityCode RegionCode
34 53
41 43
Code Table Data
-----------------
Code Meaning
34 New York
41 Boston
53 North
43 South
Desired Output
------------------
CityCode RegionCode Region City
34 53 North New York
41 43 South Boston
Use two joins:
select cc.meaning as city, cr.meaning as region
from city c left join
code cc
on c.citycode = cc.code left join
code cr
on c.regioncode = cr.code
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments