Query editor
WITHusr_rewards as (selectuser--,sum(usr_amount_sta) as usr_amount_sta,sum(usr_amount_fut) as usr_amount_fut--,sum(usr_amount_far) as usr_amount_far--,sum(usr_amount_dep) as usr_amount_depfrom(/* (selectuser,sum(cast(referrer_reward as double)/1e18) as usr_amount_sta,0 as usr_amount_fut,0 as usr_amount_far,0 as usr_amount_depfrom elephant_bnb.StampedeEngine_evt_RewardDistributiongroup by 1)UNION ALL*/(selectuser,0 as usr_amount_sta,sum(cast(referrer_reward as double)/1e18) as usr_amount_fut,0 as usr_amount_far,0 as usr_amount_depfrom elephant_bnb.FuturesEngine_evt_RewardDistributiongroup by 1)/*UNION ALL(select_user as user,0 as usr_amount_sta,0 as usr_amount_fut,sum(cast(_referrer_reward as double)/1e18) as usr_amount_far,0 as usr_amount_depfrom elephant_bnb.Vault_evt_RewardDistributiongroup by 1)UNION ALL(select_user as user,0 as usr_amount_sta,0 as usr_amount_fut,0 as usr_amount_far,sum(cast(_referrer_reward as double)/1e18) as usr_amountfrom elephant_bnb.Depot_evt_RewardDistributiongroup by 1)*/)group by 1),prep as (