I am getting this error in Google BigQuery:
Error: Ambiguous field reference in SELECT clause. (Remember to fully qualify all field names in the SELECT clause as <table.field>.)
My query is
SELECT LoanPerf1.loankey, Loans.Key
FROM prosperloans1.LoanPerf1
JOIN prosperloans1.Loans
ON LoanPerf1.loankey = Loans.Key
prosperloans1 is the dataset id
the 2 table names are correct.
the error returns regardless of which field name appears first in the select clause.
The documentation on Google SQL Syntax says this is correct:
// Simple JOIN of two tables
SELECT table1.id, table2.username
FROM table1
JOIN table2
ON table1.name = table2.name AND table1.id = table2.customer_id;
Thanks
Shawn
Try adding an AS clause to the table names:
SELECT LoanPerf1.loankey, Loans.KeyFROM prosperloans1.LoanPerf1 as LoanPerf1
JOIN prosperloans1.Loans as Loans
ON LoanPerf1.loankey = Loans.Key