我在 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;
谢谢肖恩