在查看链接中的图片时,我需要平均内爆单位和总和,我将在下面显示的结果下方附加我的代码。这几天我一直在寻找这个问题的答案。我担心我可能会试图在我的头上编码一点。
SELECT A.to_load_id AS "Cases",
A.from_qty - A.to_qty AS "Imploded Units",
( A.from_qty - A.to_qty ) * Nvl(SUM(p.qty), 1) AS "Exploded Units",
A.wskusku AS "Sku's",
A.wave AS "Wave",
A.from_loc AS "Processed Location",
A.free_form_text AS "Zone" ,
FROM audits A,
prepack P
WHERE A.from_loc LIKE 'S%'
AND A.to_loc = A.from_loc
AND free_form_text IN ( '01', '02', '03', '04',
'05', '06', '07', '08',
'09', '10', '11', '12',
'13', '14' )
AND A.wskusku = p.sku (+)
AND A.from_load_id = '42419472'
AND A.wave in ('WC055193','','','','','','','','','')
AND To_date(Substr(a.date_wms, 1, 12), 'YYYY/MM/DD HH24:MI') >=
SYSDATE - 4
GROUP BY A.to_load_id,
A.from_qty,
A.to_qty,
P.qty,
A.wskusku,
A.wave,
A.from_loc,
A.free_form_text