标签: hive hiveql
我有一个日期列,我需要使用配置单元查询与上一行日期进行日期差异吗?
答案 0 :(得分:1)
下面是查询-
select date, datediff(date, prev_date) from (select date, lag(date) over (partition by <colName> order by <Name>) as prev_date from tableName) t1;
如果可以提供带有tableName的样本数据,可以帮助您进行准确的查询