2
我有一个表,其中有一个VARCHAR列和一些时间戳列: 'date_1', ... , date_4
和'xdate_1', ... , xdate_4
我想选择其中两个依赖于“someid的价值,但直到现在还没有运气。我相信这是语法,Google搜索也没有帮助,因为所有的例子都与我的查询类似。如何使用的情况下在DB2列中选择查询
继承人是我想要做的事:
select
case
when someid = 1 then date_1
when someid = 2 then date_2
when someid = 3 then date_3
when someid = 4 then date_4
,case
when someid = 1 then xdate_1
when someid = 2 then xdate_2
when someid = 3 then xdate_3
when someid = 4 then xdate_4
from mytable;
那么,这是一个快速的答案,它完美的工作,谢谢! – JulioBordeaux 2014-08-28 10:33:40