库存转储申请单取生产订单号
小于 1 分钟
代码示例
SELECT t0.docnum,left(substring(T0.[Comments],charindex('"',T0.[Comments],0)+1,LEN(T0.[Comments])),CHARINDEX('"',?substring(T0.[Comments],charindex('"',T0.[Comments],0)+1,LEN(T0.[Comments]))?)-1)? AS 'sc'
, T1.[ItemCode],SUM( T1.[Quantity]) AS 'sqqty'
FROM OWTQ T0
INNER JOIN WTQ1 T1 ON T0.[DocEntry] = T1.[DocEntry]
WHERE T0.[Comments] LIKE '%%生产订单%%'
GROUP BY T0.[DocNum], T0.[Comments], T1.[ItemCode], T1.[Dscription]