注册

where条件后有case when语句怎么处理

孔超 2024/08/14 492 1

为提高效率,提问时请提供以下信息,问题描述清晰可优先响应。
【DM版本】:DB Version: 0x7000c
【操作系统】:windowns 10
【CPU】:x86_64
【问题描述】*:where条件后有case when语句怎么处理,如下SQL报错
select ifnull(count(1),0) from yx_sealInfo_confirm t1
LEFT JOIN yx_sealinfo_apply t5
ON t1.seal_apply_id = t5.id
LEFT JOIN yx_seal t2 ON t1.seal_id = t2.id
where t5.deleted = 0 and
t1.status in ('FLOW_SEAL_DESTORY','FLOW_SEAL_DEACTIVATE','FLOW_SEAL_RECOVERY','FLOW_SEAL_CHANGE','FLOW_SEAL_CHANGECHAPTER')
and t2.deleted =0 and t1.confirm_status=0
and t1.unit_id = '2c90ba84894abab1018a2c569ae34adf' and t2.unit_id = '2c90ba84894abab1018a2c569ae34adf'
and t5.unit_id = '2c90ba84894abab1018a2c569ae34adf'
and case when t1.status<>'FLOW_SEAL_DESTORY' then t2.seal_status<>2 and t1.deleted = 0 else t1.deleted = 0 end
and ( t2.department_id != '-1' or t2.create_id = '8a80837a8bea51f8018bea5239f60003')

回答 0
暂无回答
扫一扫
联系客服