易飛有庫存且超期15天未交訂單的單身明細

2021-06-19 09:02:18 字數 494 閱讀 4432

select tc004 as 客戶編號,ma002 as 客戶簡稱,td001 as 訂單單別,td002 as 訂單單號,td003 as 序號,td004 as 品號,td005 as 名稱,td006 as 規格,td008 as 訂單數量,td009 as 已交數量,td010

as 訂單單位,mb064 as 庫存數量,mb004 as 庫存單位,td013 as 訂單交貨日期

from  coptd

left join invmb on td004=mb001

left join coptc on tc001=td001 and tc002=td002

left join copma on tc004=ma001

where td008>td009 and td016='n' and td0130

問題有:

可能明細裡整張單工單還是沒有完成,所以部份明細沒有交貨有庫存正常

但是可以提醒一下管理者找找超期這麼久還是可以的