Nested Case statement type error (postgres)

前端 未结 2 1296
春和景丽
春和景丽 2021-01-25 18:06

I have some postgres code I have created that is giving me an error:

ERROR:  CASE types character varying and numeric cannot be matched

CODE:

2条回答
  •  情书的邮戳
    2021-01-25 19:05

    Try eliminating the nested case. Maybe it makes a difference to the compiler for some reason:

    CASE
        WHEN b.condition = 'ERROR' AND c.condition2 = 'ERROR' THEN d.condition3
        WHEN b.condition = 'ERROR' THEN c.condition2
        ELSE c.condition
    END as current_condition,
    ...
    

提交回复
热议问题