34,593
社区成员
发帖
与我相关
我的任务
分享
--假设订单表和入库表的关联字段为ddid
select * from 订单表 a where not exists(select 1 from 入库表 where ddid=a.ddid)
--这样就查出来了所有订单还没到货的数据
--只统计未到货的数量的话
select count(*) from 订单表 a where not exists(select 1 from 入库表 where ddid=a.ddid)