gpt4 book ai didi

sql - 加入 hive 会产生笛卡尔积

转载 作者:行者123 更新时间:2023-12-02 21:49:25 35 4
gpt4 key购买 nike

我在 hive 中有一个查询,如下所示。它给了我笛卡尔积。

insert into table processed 
select c.plc,c.direction,c.table,t.speed as speed,t1.id
from staging t
JOIN central c
ON (t.id = c.boxno)
JOIN idsfortime t1

where ( t1.epochtime >= t.time
OR t1.epochtime <= t.time);

我不要笛卡尔积。请提出建议。

最佳答案

如果以您真正想要的方式声明了WHERE子句,则无法避免产品联接。但是也许您想加入t1.epochtime = t.time。没有关于表的更多信息,就无法确定。

您可能要在问题中显示完整的表定义。

关于sql - 加入 hive 会产生笛卡尔积,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22316549/

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