有人可以帮助解决以下的hive查询。我知道下面的内容不会起作用,因为hive不支持非equi连接。
SELECT a.ymd, a.price_close, b.price_close
FROM stocks a
JOIN stocks b ON a.ymd <= b.ymd
WHERE a.symbol = 'AAPL' AND b.symbol = 'IBM';
答案 0 :(得分:0)
您可以交叉加入然后过滤:
SELECT a.ymd, a.price_close, b.price_close
FROM
(select a.ymd, a.price_close from stocks a where a.symbol = 'AAPL') a
CROSS JOIN (select b.ymd, b.price_close from stocks b where b.symbol = 'IBM') b
WHERE a.ymd <= b.ymd;