需要在没有提及分割键的情况下获取表中的最新结果。例如,需要.Problems面对的最新推文如下:
create table test2.threads(
thread text ,
created_date timestamp,
forum_name text,
subject text,
posted_by text,
last_reply_timestamp timestamp,
PRIMARY KEY (thread,last_reply_timestamp)
)
WITH CLUSTERING ORDER BY (last_reply_timestamp DESC);只有当我知道分割键时,我才能检索数据。
select * from test2.threads where thread='one' order by last_reply_timestamp DESC;如何在不提及where条件的情况下获得按desc排序的最新线程?
发布于 2016-02-07 07:22:43
您的数据模型不适合用于此目的。分区没有排序。您必须遍历分区键,获取一些分区键,然后查看哪些分区键是应用程序级别的最新分区键。
https://stackoverflow.com/questions/35244352
复制相似问题