1
我是HIVE的新手,我需要從配置單元中的表中獲取上個月的最後一天。在HIVE查詢中獲取上個月的最後一天
SQL相當於---
select last_day(add_months(sysdate,-1)) from dual;
我只能得到前一天是像
select *
from table1
where dt >= from_unixtime(unix_timestamp()-1*60*60*24, 'yyyyMMdd');
可能有人請幫我查詢互聯網?
感謝 拉克什
的可能的複製[查找蜂巢一個月的最後一天(http://stackoverflow.com/questions/17548584/find-last-day配置月) –
嗨,你可以檢查這個問題。這跟你的差不多。 http://stackoverflow.com/questions/17548584/find-last-day-of-a-month-in-hive –
謝謝Canburak ,,我做了這樣的事情----- date_sub(from_unixtime(UNIX_TIMESTAMP(), 'yyyy-MM-dd'),day(from_unixtime(UNIX_TIMESTAMP(),'yyyy-MM-dd'))) –