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都只能针对一个表操作!
欢迎转载,但请注明内容的来源或URL;
“[转]”篇章,必须保留原始来源且勿添加本blog指向。