我有两个表A和B,它们都具有以下结构.
// Table A
Name Age actualdate no
// Table B
City sdate edate id
Run Code Online (Sandbox Code Playgroud)
我希望使用JOIN获取A和B中的所有字段,其中,id = no和sdate <= actualdate和edate> = actualdate.
我使用where子句尝试如下,但它不起作用.
select v3.*, t3.* from A v3
JOIN
B t3
where v3.id = t3.no and
v3.sdate <= t3.actualdate and
v3.edate >= t3.actualdate
limit 1;
Run Code Online (Sandbox Code Playgroud)
使用On子句:
select v3.*, t3.* from A v3
JOIN
B t3
ON ( v3.id = t3.no and
v3.sdate <= t3.actualdate and
v3.edate >= t3.actualdate )
limit 1;
Run Code Online (Sandbox Code Playgroud)
不幸的是,Hive不支持equijoin.有没有办法使用连接实现上述功能?