我想知道有没有一种简单的方法把这两张table连在一起。
表“表1":
| 姓名|来自国家ID|目的地国家ID|
| - ------|- ------|- ------|
| 萨姆|1个|第二章|
| 背风面|三个|四个|
| 约翰|第二章|1个|
| 果渣|零|三个|
表“表2":
| 国家ID|国家名称|
| - ------|- ------|
| 1个|美国|
| 第二章|联合 Realm |
| 三个|加拿大|
| 四个|尼泊尔|
select t1.name,
fromTab.countryName as FromCountry,
toTab.countryName as ToCountry
from table1 t1
left join table2 fromTab on fromTab.countryId = t1.fromCountryId
left join table2 toTab on toTab.countryId = t1.toCountryId
1条答案
按热度按时间zf9nrax11#
请尝试以下操作:
或