已审核的订单,没有生成发货单的

SELECT *
FROM v_sale_order so LEFT JOIN wms_order wo ON so.sale_order_id = wo.sale_order_id
                                               AND wo.is_cancel = 0
                                               AND wo.is_usable = 1
                                               AND wo.tenant_id = 100030
WHERE so.is_usable = 1
      AND so.is_checked = 1
      AND so.is_to_be_shipped = 1
      AND so.tenant_id = 100030
     AND so.platform_order_status not in ("TRADE_FINISHED","TRADE_CLOSED")
      AND wo.wms_order_id IS NULL; 
 
注意:
1.left join on后面添加的是右表的过滤条件,对于左表的条件 无效果
2.where 会对左右表都进行过滤
posted @ 2017-03-09 22:47  聚变归来  阅读(440)  评论(0编辑  收藏  举报