zoukankan      html  css  js  c++  java
  • mysql null不参与计算 AlanTuring

    今天遇到个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 )

    才符合实际需求

  • 相关阅读:
    maven-仓库
    maven-坐标与依赖
    maven-认识
    mysql-介绍
    redis-主从复制
    UVA
    UVA
    UVA
    UVA
    [ Java学习 ] 查阅资料整理 004
  • 原文地址:https://www.cnblogs.com/alanturingson/p/15693960.html
Copyright © 2011-2022 走看看