gpt4 book ai didi

google-bigquery - 如何克服连接联合表与其他表的错误

转载 作者:行者123 更新时间:2023-12-03 23:08:05 28 4
gpt4 key购买 nike

当我们尝试将一侧的联合表与另一侧的其他表连接时,

SELECT A.x,B.y FROM ([DataSet.Liad],[DataSet.Livne]) AS A INNER JOIN [DataSet.Names] AS B ON A.ID = B.ID LIMIT 10

我们得到这个错误:

Error: 2.1 - 0.0: JOIN cannot be applied directly to a table union or to a table wildcard function. Consider wrapping the table union or table wildcard function in a subquery (e.g., SELECT *).



为了解决这个错误,我建议你使用一个 View 。
将此联合查询保存为 View DataSet.LiadLivne:
SELECT * FROM [DataSet.Liad],[DataSet.Livne] 

使用 View 执行原始查询:
SELECT A.x,B.y FROM [DataSet.LiadLivne] AS A INNER JOIN [DataSet.Names] AS B ON A.ID = B.ID LIMIT 10

享受

最佳答案

你需要写成:

SELECT A.x,
B.y
FROM
(SELECT A.x
FROM ([DataSet.Liad],[DataSet.Livne])) AS A
INNER JOIN [DataSet.Names] AS B ON A.ID = B.ID LIMIT 10

关于google-bigquery - 如何克服连接联合表与其他表的错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31636778/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com