mysql null不参与计算
2021/12/16 2:45:23
本文主要是介绍mysql null不参与计算,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
今天遇到个bug 先看原sql:
delete p from qtylabelspromgdinfo p, goods g where g.Code = p.SpuCode and p.bufferid = 'edebb561-a350-42ed-85f3-7c917f7a0307' and p.storecode = '4846' and g.storecode = '4846' and p.queryuuid = '68defa53-f5b2-4729-a9a8-b21b5ce6f121' and ( g.f1 NOT IN ('0') )
结果删除完的数据,除了f1为0的,还存在一堆f1=null的数据
修改完:
delete p from qtylabelspromgdinfo p, goods g where g.Code = p.SpuCode and p.bufferid = 'edebb561-a350-42ed-85f3-7c917f7a0307' and p.storecode = '4846' and g.storecode = '4846' and p.queryuuid = '68defa53-f5b2-4729-a9a8-b21b5ce6f121' and ( g.f1 NOT IN ('0') or g.f1 is null )
才符合实际需求
这篇关于mysql null不参与计算的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-09-21MySQL集群部署资料:新手入门教程
- 2024-09-21MySQL集群资料:初学者入门指南
- 2024-09-21部署MySQL集群资料:新手入门教程
- 2024-09-20MySQL集群部署教程:新手入门指南
- 2024-09-20MySQL集群教程:初学者必备指南
- 2024-09-20部署MySQL集群项目实战:新手入门教程
- 2024-09-20如何部署MySQL集群:简单教程
- 2024-09-20MySQL集群部署:新手入门指南
- 2024-09-20部署MySQL集群学习:入门指南
- 2024-09-20部署MySQL集群入门教程