cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vladimir Yudovin <>
Subject Re: Ordering by multiple columns?
Date Sun, 09 Oct 2016 04:20:20 GMT
Yes, look at this example. But you need to add 'fake' partition with the same value  for all
rows, that will cause them to be stored on the same nodes.

Best regards, Vladimir Yudovin, 
Winguzone - Hosted Cloud Cassandra on Azure and SoftLayer.
Launch your cluster in minutes.

---- On Sat, 08 Oct 2016 20:04:21 -0400 Ali Akhtar &lt;; wrote

Is it possible to have multiple clustering keys in cassandra, or some other way to order by
multiple columns?

For example, say I have a table of songs, and each song has a rating and a date.

I want to sort songs by rating first, and then with newer songs on top.

So if two songs have 5 rating, and one's date is 1st Feb, the other is 2nd Feb, then I want
the 2nd feb one to be sorted above the 1st feb one.

Like this:

Select * from songs order by rating, createdAt

Is this possible?


View raw message