2
我有这样的主表:SQL服务器 - 如何值映射到主表
tblMain
-----------------------------------------------
|ClientNo|Country1|Country2|Country3|Agreement|
|--------+--------+--------+--------+---------|
|111123 |SG |TH |PH |OA1 |
|111222 |PH |MY |JP |OA2 |
|323211 |MY |SG |PH |OA3 |
-----------------------------------------------
和我有这些映射表:
tblCountry
-------------------------
|CountryCode|CountryName|
|-----------+-----------|
|SG |Singapore |
|MY |Malaysia |
|PH |Philippines|
|TH |Thailand |
|JP |Japan |
-------------------------
tblAgreement
--------------------
|ACode|ADescription|
|-----+------------|
|OA1 |Agreement1 |
|OA2 |Agreement2 |
|OA3 |Agreement3 |
--------------------
我需要实现的是刚刚返回主表而不是代码,我需要映射的名称/描述。 所以在我的例子,它应该是这样的:
-------------------------------------------------------
|ClientNo|Country1 |Country2 |Country3 |Agreement |
|--------+-----------+---------+-----------+--------- |
|111123 |Singapore |Thailand |Philippines|Agreement1|
|111222 |Philippines|Malaysia |Japan |Agreement2|
|323211 |Malaysia |Singapore|Philippines|Agreement3|
-------------------------------------------------------
能否请您帮助我如何解决这个问题?提前谢谢
你能合并三张表吗?并获得一个表的输出。 –
你需要什么? –