title: Cassandra CQL - clustering order with multiple clustering columns
body: <p>I have a column family with primary key definition like this:</p>
  
  <pre><code>...
  PRIMARY KEY ((website_id, item_id), user_id, date)
  </code></pre>
  
  <p>which will be queried using queries such as:</p>
  
  <pre><code>SELECT * FROM myCF
  WHERE website_id = 30 AND item_id = 10
  AND user_id = 0 AND date &gt; 'some_date' ;
  </code></pre>
  
  <p>However, I'd like to keep my column family ordered by date only, such as <code>SELECT date FROM myCF ;</code> would return the most recent inserted date.</p>
  
  <p>Due to the order of clustering columns, what I get is an order per user_id then per date.
  If I change the primary key definition to:</p>
  
  <pre><code>PRIMARY KEY ((website_id, item_id), date, user_id)
  </code></pre>
  
  <p>I can no longer run the same query, as date must be restricted is user_id is.</p>
  
  <p>I thought there might be some way to say:</p>
  
  <pre><code>...
    PRIMARY KEY ((website_id, shop_id), store_id, date)
  ) WITH CLUSTERING ORDER BY (store_id RANDOMPLEASE, date DESC) ;
  </code></pre>
  
  <p>But it doesn't seem to exist. Worst, maybe this is completely stupid and I don't get why.</p>
  
  <p>Is there any ways of achieving this? Am I missing something?</p>
  
  <p>Many thanks!</p>