with p1 as(
select
abroad_name,
account_month,
account_year,
bu_name,
etl_time,
index_name,
material_category,
material_group_code,
material_group_name,
material_no,
plant_code,
index_value,
(case
when index_name='实际在库' then '实际'
when index_name='实际在途' then '实际'
when index_name='标准在库' then '标准'
when index_name='标准在途' then '标准'
end )as index_name_1
from
jks_integration_inv_ads.ads_inv_integrate_df t)
select
aborad_name,
bu_name,
index_name_1,
sum( index_value )
from
p1
group by
aborad_name,
bu_name,
index_name_1