Table schema goes like this:
image_id | activity_time | image_location
----------+---------------+--------------------
243 | 2021-10-22 | remotelocation_243
243 | 2021-10-25 | remotelocation_243
88 | 2021-10-12 | remotelocation_88
215 | 2021-10-20 | remotelocation_215
215 | 2021-10-21 | remotelocation_215
215 | 2021-10-22 | remotelocation_215
215 | 2021-10-25 | remotelocation_215
80 | 2021-10-12 | remotelocation_80
248 | 2021-10-20 | remotelocation_248
248 | 2021-10-21 | remotelocation_248
248 | 2021-10-22 | remotelocation_248
248 | 2021-10-25 | remotelocation_248
234 | 2021-10-20 | remotelocation_234
234 | 2021-10-21 | remotelocation_234
234 | 2021-10-22 | remotelocation_234
234 | 2021-10-25 | remotelocation_234
11 | 2021-10-12 | remotelocation_11
501 | 2021-10-22 | remotelocation_501
1 | 2021-10-12 | remotelocation_1
509 | 2021-10-22 | remotelocation_509
78 | 2021-10-12 | remotelocation_78
96 | 2021-10-12 | remotelocation_96
539 | 2021-10-22 | remotelocation_539
I want to get last N records basis the activity_time. I read following:
Cassandra + Fetch the last records using in query
Order latest records by timestamp in Cassandra
However, I am seeing that it requires some sort of where clause to get results from order by.
I just want to do something like this:
select * from table_name order by activity_time desc limit 20;
Any help is greatly appreciated. Thanks in advance.