where 子句中的多个 Case 条件

Multiple Case conditions in where clause

我有一个 table,其中有 2 列。 F1 和 F2。现在 F1 有 Id,F2 有分数。

F1 Score
1   10
1   20
6   10

现在我想要一个 where 子句,它将 6 视为 1 并将它们与 1 相加

例如,当我使用 when F1=1 时,它应该给出

 F1 Score
    1   10
    1   20
    1   10

我用过

WHERE (F1 = CASE WHEN 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