[英]HIve join with a where query
I basically want to to a cross join with my store-product master list with the calendar table that has all possible dates. 我基本上想与具有所有可能日期的日历表与我的商店产品主列表进行交叉连接。 However, i want to filter for a year (365 days) before making the join with the master list.
但是,我想过滤一年(365天),然后再加入主列表。
I am trying the following query - 我正在尝试以下查询-
select * from ( select a.store_id,a.product_id from mez_2018_store_product_lst) a cross join
(select b.day_id,cast(to_date(from_unixtime(unix_timestamp(b.day_date, 'yyyy-MM-dd'))) as b.date from calendar where day_id>=20170101 and day_id<=20180101 ) b
And I keep getting EOF error. 而且我不断收到EOF错误。 Can you guys help ?
你们可以帮忙吗?
Try with below query: 尝试以下查询:
hive> select * from
(select store_id,
product_id from mez_2018_store_product_lst) a
cross join
(select day_id,
to_date(from_unixtime(unix_timestamp(day_date, 'yyyy-MM-dd')))dt from calendar
where day_id>=20170101 and day_id<=20180101 ) b;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.