我试图做一个CASE声明。要求是,如果Date字段为NULL,则将其显示为“Pending”,或者显示db中的日期。
我已尝试过以下案例陈述,但存在一些问题。
CASE po_amend_received_date IS NULL WHEN 1 THEN 'Pending'
ELSE po_amend_received_date END AS `po_amend_received_date`
我在这里犯了什么错误吗?
答案 0 :(得分:0)
CASE WHEN po_amend_received_date IS NULL THEN 'Pending'
else po_amend_received_date
end as `po_amend_received_date`