Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hola a todos,
Escribo en la comunidad porque no consigo la manera de como incluir un registro calculado dentro de un load que se genera de 2 consultas con un concatenar. Explico:
Tengo 2 consultas que concateno:
Total_Net_Rates_tmp:
Load trade_date_cs as net_trade_date_cs_sumry
, 'Total Net Rates' as filter_group_net_rates_cs_sumry
, 'FI' as main_group_net_rates_cs_sumry
, 'CIB' as sub_group1_net_rates_cs_sumry
, 'Project Finance' as sub_group2_net_rates_cs_sumry
, cib_us_relationship_cs as net_trade_cib_us_relationship_cs_sumry
, sum(net_rates_fi_cs) as net_rates_fi_cs_sumry
, sum(sales_credit_cs) as sales_credit_cs_sumry
, if(cib_us_relationship_cs = 'Y'
,'US Lending'
,'Non-US Lending'
) as sub_group3_net_rates_cs_sumry
, sum( if(pf_indicator_cs = 'PF' and bus_line_cs = 'MRG'
,net_rates_fi_cs - sales_credit_cs
,0
)
) as net_rates_dtd_pl_sumry
Resident Corporate_Sales
group by trade_date_cs
,cib_us_relationship_cs ;
Concatenate
Load trade_date_cs as net_trade_date_cs_sumry
, 'Total Net Rates' as filter_group_net_rates_cs_sumry
, 'FI' as main_group_net_rates_cs_sumry
, 'CIB' as sub_group1_net_rates_cs_sumry
, 'Corporates' as sub_group2_net_rates_cs_sumry
, cib_us_relationship_cs as net_trade_cib_us_relationship_cs_sumry
, sum(net_rates_fi_cs) as net_rates_fi_cs_sumry
, sum(sales_credit_cs) as sales_credit_cs_sumry
, if(cib_us_relationship_cs = 'Y'
,'US Lending'
,'Non-US Lending'
) as sub_group3_net_rates_cs_sumry
, sum( if( bus_line_cs = 'MRG'
,net_rates_fi_cs
,0
)
-
if(pf_indicator_cs = 'PF' and bus_line_cs = 'MRG'
,net_rates_fi_cs - sales_credit_cs
,0
) ) as net_rates_dtd_pl_sumry
Resident Corporate_Sales
group by trade_date_cs
,cib_us_relationship_cs ;
Exit Script;
Lo que quiero hacer es que pueda crear un nuevo registro dentro Total_Net_Rates_tmp, sumando los campos net_rates_fi_cs_sumry, sales_credit_cs_sumry y net_rates_dtd_pl_sumry sin necesidad de tener que hacer otro concatenar para crear el nuevo registro con suma todos los calculos que hago en cada una de ella.
He visto la guía y creo que seria con un LOAD precedente pero no se como hacerlo.
net_trade_date_cs_sumry
, filter_group_net_rates_cs_sumry
, main_group_net_rates_cs_sumry
, 'CIB' as sub_group1_net_rates_cs_sumry
, ' ' as sub_group2_net_rates_cs_sumry
, sum(net_rates_fi_cs_sumry)
, sum( sales_credit_cs_sumry)
sum(net_rates_dtd_pl_sumry)
Alguien me puede ayudar??
espero que he explicara bien 🙂
Muchas gracias a todos de antemano.
Saludos,
Hola, puedes utilizar un resident para esto.