我需要根据以下条件连接两个表。我的table看起来像
id,date
12,20190114
13,20190118
14,20190123
表b看起来像
id,date
13,20190108
12,20190108
13,20190101
13,20190115
14,20190129
14,20190122
当我应用连接条件时,我需要考虑以下几点
1. id should be same for both tables
2. date from table A should join with the date previous to the table B
dates(table B dates are weekly basis... I need to find the current week).
也就是说,表b中的日期是每周的日期。例如,对于id=13,表a的日期是20190118,表b的相应日期是20180115,即表a所属的当前星期。。。
加入后我的成绩应该是怎么样的
id,a.date,b.date
13,20190118,2018015
12,20190114,20190108
14,20190123,20190122
有人能告诉我在Hive里怎么做吗
1条答案
按热度按时间xxb16uws1#
这个在 hive 里用吗?
这里有一个db<>fiddle,显示它对提供的数据有效,尽管是在postgres中。