使用#StandardSQL时出现Ambigious Column错误

时间:2018-02-05 18:54:30

标签: google-bigquery

这是一个我想要运行的简单查询。我在两个表中加入了Data_Dt列。如何使用表名和数据集名称限定Data_Dt以避免Ambigious Column错误?我可以在Legacy SQL中使用它,但由于广泛的函数库支持,我想切换到标准SQL。在此先感谢您的帮助!

#standardSQL
SELECT
  Data_Dt AS `Data_Dt`
FROM
  `testDataSet.Origination`
INNER JOIN
  `testDataSet.Transition`
ON
  `testDataSet.Origination`.`Loan_Num_Q` = `testDataSet.Transition`.`Loan_Num_Q`
GROUP BY
  `Data_Dt`

1 个答案:

答案 0 :(得分:2)

#standardSQL
SELECT
  a.Data_Dt AS Data_Dt
FROM `testDataSet.Origination` a
INNER JOIN `testDataSet.Transition` b
ON a.Loan_Num_Q = b.Loan_Num_Q
GROUP BY a.Data_Dt