我有一个表,有3列: PrimaryKey,“德语”和“英语”。
这里有一些翻译。
现在,我想要传递特定列的值。
如果有“德语”语言,则应选择“德语”栏。
反之,如果这门语言是"English",那么当然列"English“。
因此,我希望根据语言映射选择正确的列。
表:
-----------+--------+---------
|PrimaryKey|German | English|
-----------+--------+---------
|1 | Haus | house |
-----------+--------+---------
|2 | Garten | garden |
-----------+--------+---------
|3 | Apfel | apple |
-----------+--------+---------客户德国鸡PK=2,所以他得到了"Garten“。
客户英语鸡PK=1,所以他得到了"house“。
Thx
发布于 2016-04-04 07:11:49
添加customer表
customerId Name
1 English
2 German--添加fk_constraint客户-客户add
SELECT
case when customer = 1 then t.English else t.German end as [Language]
--or
case when c.Name = 'English' then t.English else t.German end as [Language]
FROM translations as t
INNER JOIN customer as c on c.customerID = t.customer发布于 2016-04-04 07:04:25
从tableName中选择colName1、colName2
https://stackoverflow.com/questions/36392289
复制相似问题