zoukankan      html  css  js  c++  java
  • MySQL中 delete from 时提示 1064 错误。

    select * from wms_inventory i WHERE not EXISTS (select 1 from wms_item t where t.id=i.SKU_ITEM_ID and t.company_id=i.COMPANY_ID);

    select *  from wms_inventory i LEFT JOIN wms_item t on t.id=i.SKU_ITEM_ID and t.company_id=i.COMPANY_ID where t.id is null;

    delete from wms_inventory i WHERE not EXISTS (select 1 from wms_item t where t.id=i.SKU_ITEM_ID and t.company_id=i.COMPANY_ID);

    delete from wms_inventory i LEFT JOIN wms_item t on t.id=i.SKU_ITEM_ID and t.company_id=i.COMPANY_ID where t.id is null;

    改为

    delete i.* from wms_inventory i WHERE not EXISTS (select 1 from wms_item t where t.id=i.SKU_ITEM_ID and t.company_id=i.COMPANY_ID);

    delete i.* from wms_inventory i LEFT JOIN wms_item t on t.id=i.SKU_ITEM_ID and t.company_id=i.COMPANY_ID where t.id is null;

    原因:因为insert、update、delete都只能针对一个表操作!

    Tty725 说:
    欢迎转载,但请注明内容的来源或URL;
    [转]”篇章,必须保留原始来源且勿添加本blog指向。
  • 相关阅读:
    最近的几个坑
    最近对Allegro的几个总结
    sub drawing
    Allegro的几点小结
    产品量产的几个问题
    电源板问题的定位
    PCB学习
    servlet(6) 链接数据库
    servlet(5) HttpSession
    servlet(4)异常处理
  • 原文地址:https://www.cnblogs.com/Tty725/p/10983336.html
Copyright © 2011-2022 走看看