Data Contains unique IDs with different latitudes and longitudes on multiple timestamps.I would like to select the rows of latest 30 days of coordinates for each unique ID.Please help me on how to run the query . This date is in Hive table.unable write the sub query
You can use window functions:
select t.*
from (select t.*,
max(date) over (partition by id) as max_date
from t
) t
where date > date_add(max_date, -30);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.