sql - Trying to create a view with an inline view joining 3 tables -


i trying create view on google bigquery keep getting error of:

failed save view. ambiguous field name 'alias' in join. please use table qualifier before field name.

i trying create view user able see each player_id total of converted_deposit_amount each specfied value of calculated month_difference.

i have joined 3 tables within inline view, can run query fine getting error, there reason why , how can resolve this?

select player_id, round(sum(if(month_difference_m = 1, converted_deposit_amount, 0)),2) m1_real_deposit_gbp, round(sum(if(month_difference_m = 2, converted_deposit_amount, 0)),2) m2_real_deposit_gbp, round(sum(if(month_difference_m = 3, converted_deposit_amount, 0)),2) m3_real_deposit_gbp, round(sum(if(month_difference_m > 2, converted_deposit_amount, 0)),2) m2_plus_deposit_gbp (   select   pl.player_id player_id,   (12 * year(pf.date) + month(pf.date)) - (12 * year(pl.ftd_date) + month(pl.ftd_date)) + if (day(pf.date) >= day(pl.ftd_date), 0, -1) + 1 month_difference_m,   (case   when pf.currency = 'cad' pf.deposit_real_funds_amount*er.cad   when pf.currency = 'nzd' pf.deposit_real_funds_amount*er.nzd   when pf.currency = 'eur' pf.deposit_real_funds_amount*er.eur   when pf.currency = 'aud' pf.deposit_real_funds_amount*er.aud   when pf.currency = 'nok' pf.deposit_real_funds_amount*er.nok   when pf.currency = 'sek' pf.deposit_real_funds_amount*er.sek   when pf.currency = 'usd' pf.deposit_real_funds_amount*er.usd   else pf.deposit_real_funds_amount   end) converted_deposit_amount   [enigma-1180:tableau.playerfinancials] pf   join [enigma-1180:tableau.playerlookup] pl   on pl.player_id = pf.player_id   join [enigma-1180:tableau.exchangerates] er   on er.date = pf.date ) src group player_id 


Comments

Popular posts from this blog

neo4j - finding mutual friends in a cypher statement starting with three or more persons -

php - How to remove letter in front of the word laravel -

minify - Minimizing css files -