我选择我工作正常的abc_value。我添加了方差和CC_date。但返回的多行具有相同的日期。我想用行显示总计的日期。然后它还向我显示了每个方差的一行,我希望它求和多少,我相信它当前正在显示每行,因为它显示了QTY方差,我不希望我只想告诉我那里有5个A的变化...
SELECT abc_value,trunc(cc_date),-- variance_
COUNT(*) AS num_abc_values
FROM (
select distinct
dsp_sku, case
when EXPTD_QTY <> ACTL_INVN_QTY then (EXPTD_QTY-ACTL_INVN_QTY)*(-1)
else null
end as variance_
,decode (cc.stat_code, '0', 'Unprocessed', '90', 'Processed', '99', 'Expired') as Status,
trunc(cc.create_date_time) CC_date,
case
when dsp_sku = 'EGIA60AMT' then 'A'
when dsp_sku = 'LF1937' then 'A'
when dsp_sku = '980X3ENDIUU' then 'A'
when dsp_sku = '186-0106' then 'A'
when dsp_sku = 'PM35MN02' then 'A'
when dsp_sku = '980X1ENDIUU' then 'A'
when dsp_sku = 'LF1837' then 'A'
when dsp_sku = 'VLFT10GEN' then 'A'
when dsp_sku = 'LF1212A' then 'A'
when dsp_sku = 'SIGC60MT' then 'B'
when dsp_sku = 'GS833' then 'B'
when dsp_sku = '5.5 PED' then 'B'
when dsp_sku = 'L74' then 'B'
when dsp_sku = 'VLOCL2105' then 'B'
when dsp_sku = 'VLOCM0134' then 'C'
when dsp_sku = '8886471021V' then 'C'
when dsp_sku = 'SILSCLINCH46' then 'C'
when dsp_sku = 'E1465' then 'C'
when dsp_sku = 'SM691' then 'C'
when dsp_sku = 'LS3112' then 'C'
when dsp_sku = 'SSV' then 'C'
when dsp_sku = '8886321956' then 'C'
when dsp_sku = 'Y-CGVPD' then 'D'
when dsp_sku = 'YCN1800P' then 'D'
when dsp_sku = 'YCN1801P' then 'D'
when dsp_sku = 'Y-REFACH-X-E' then 'D'
when dsp_sku = 'ZL7777-0091' then 'D'
else 'Empty Location'
end as ABC_Value
from WH_GHC1.CYCLE_COUNT_HIST cc
left join item_master im on
im.sku_id = cc.sku_id
inner join locn_hdr lh on
lh.locn_id = cc.locn_id
where
cc.whse = 'PH3'
--and cc.stat_code in ('0','90') --stat_code: 0 is unprocessed, 90 is processed, 99 is expired
and cc.stat_code = 90
--and cc.stat_code = 0
--and cc.create_date_time between '&FromDate' and '&EndDate'
and
cc.create_date_time > '&StartDate'
--and dsp_sku = '&SKU'
--and not im.srl_nbr_reqd = 4
--and EXPTD_QTY = 0
--and actl_invn_qty = 0
)
GROUP BY abc_value,Variance_,cc_date
我试图选择没有运气的非同小异……我试图对没有运气的行求和,这可能做错了。感谢您提供任何反馈意见,非常感谢。我尝试过选择没有运气的项目...香港专业教育学院试图总结运气不好的行,可能做错了。感谢您提供任何反馈意见。