我有这个:COALESCE(amount ,0) as amount
。为数据类型amount
是numeric
。
而不是0
我想要N/A
。我怎样才能做到这一点?我收到错误消息:
ERROR: invalid input syntax for type numeric: "N/A"
您的情况更适合此代码: coalesce(cast(nullif(amount, 0) as text), 'N/A')
以及有关保存的其他信息:
case
when coalesce(cast(nullif(a.amount1, 0) as text), 'N/A') = 'N/A' then 'N/A'
when coalesce(cast(nullif(a.amount2, 0) as text), 'N/A') = 'N/A' then 'N/A'
else (coalesce(cast(nullif(a.amount1 - a.amount2, 0) as text), 'N/A'))
end as savings
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句