发货时间-出库时间〈0 可以表述为: 发货时间<出库时间 发货时间-入库时间〈0 可以表述为: 发货时间<入库时间select a.hth from order_detail a join order_sell_data b on a.hth=b.hth and a.finish_date <b.rp union select a.hth from oder_detail a join data_product_indepot c on a.hth=c.hth and a.finish_date< c.rp
select 表A.* from 表A a,表B b,表C c where a.主键 = b.主键 and a.主键 = c.主键 and datediff(d,A.finish_date,B.rq) < 0 and datediff(d,A.finish_date,c.rq) >0
发货时间-入库时间〈0 可以表述为: 发货时间<入库时间select a.hth from order_detail a join order_sell_data b on a.hth=b.hth and a.finish_date <b.rp
union
select a.hth from oder_detail a join data_product_indepot c on a.hth=c.hth and a.finish_date< c.rp
where a.主键 = b.主键 and a.主键 = c.主键 and datediff(d,A.finish_date,B.rq) < 0 and
datediff(d,A.finish_date,c.rq) >0