【发布时间】:2016-05-16 14:56:43
【问题描述】:
需要在不提及分区键的情况下获取表中的最新结果。比如需要最新的推文。面临的问题如下,
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 排序最新线程?
【问题讨论】: