1

我在 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是 2 个表名正确的数据集 ID。无论哪个字段名称首先出现在 select 子句中,都会返回错误。

Google SQL Syntax 上的文档说这是正确的:

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

谢谢肖恩

4

1 回答 1

0

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

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

于 2012-07-30T19:47:12.770 回答