具有 Or 条件的 Mysql 案例
如何在mysql查询中编写一个案例,用于检查特定列的null或0
CREATE TABLE tblConfirmationStatus (Confirm_Status TINY INT) INSERT INTO tblConfirmationStatus Confirm_Status VALUES (1), (0), (1), ({null}), (0), (1), ({null})
所需输出
确认状态
Confirmed Not Confirmed Confirmed Not Confirmed Not Confirmed Confirmed Not Confirmed
0 或空 - 未确认,1-已确认
SELECT CASE Confirm_Status WHEN NULL OR 0 THEN 'Not Confirmed' ELSE 'Confirmed' END AS ConfirmStatus FROM tblConfirmationStatus;