[英]Multiple Case conditions in where clause
我有一张桌子,那里有2列。 F1和F2。 现在,F1具有ID,F2具有得分。
F1 Score
1 10
1 20
6 10
现在我想要一个where子句,其中将6视为1并将它们加1
例如当我使用F1 = 1时
F1 Score
1 10
1 20
1 10
我用过
在哪里(F1 =当F1 = 6然后THEN 1 ELSE F1 END的情况)
但不起作用。
您似乎想要:
select (case when f1 = 6 then 1 else f1 end) as new_f1,
score
from t
order by new_f1;
编辑:
您改变了问题。 对于过滤,您只需执行以下操作:
where f1 in (1, 6)
尝试这个:
select (case when F1 = 6 then 1 else F1 end) as something, SCORE
from your_table
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.