我需要一个 WHERE 子句来仅评估某些语句。就像是:
WHERE field_a = field_b AND
(CASE WHEN <PARAM>type</PARAM> = 5
THEN {field_c = 1 OR field_c = 2}
WHEN <PARAM>type</PARAM> = 6
THEN {field_c = 3 OR field_c = 4}
ELSE field_c = <PARAM>type</PARAM>
这样当 Param 类型 = 5 时,它只检查 field_c = 1 还是 2。有什么想法吗?