使用 Apache Hive,我尝试使用系统 current_date 获取上个月的最后一天。我可以使用 last_day(current_date) 找到当前月份的最后一天,但我需要上个月。我尝试过使用 add_months(-1) 和 date_add 到 current_date,但这给了我一个错误,指出该函数不存在。
期待上个月的最后一天
我尝试了以下方法,效果很好。
select last_day(add_months(current_date, -1));
如果这不能解决您的问题,请分享查询、错误和 Hive 版本