SQL语法JOIN google bigquery

时间:2012-07-30 19:32:57

标签: google-bigquery

我在Google BigQuery中收到此错误:

Error: Ambiguous field reference in SELECT clause. (Remember to fully qualify all field names in the SELECT clause as <table.field>.)

我的查询是

SELECT LoanPerf1.loankey, Loans.Key
FROM   prosperloans1.LoanPerf1
JOIN   prosperloans1.Loans
       ON LoanPerf1.loankey = Loans.Key

prosperloans1是数据集ID 2个表名是正确的。 无论select子句中首先出现哪个字段名称,都会返回错误。

Google SQL语法的文档说这是正确的:

// 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;

由于 肖恩

1 个答案:

答案 0 :(得分:0)

尝试在表名中添加AS子句:

SELECT LoanPerf1.loankey, Loans.Key FROM prosperloans1.LoanPerf1 as LoanPerf1 JOIN prosperloans1.Loans as Loans ON LoanPerf1.loankey = Loans.Key