I prepared the following table "keyspaceB.memobox"
DROP TABLE IF EXISTS keyspaceB.memobox;
CREATE TABLE IF NOT EXISTS keyspaceB.memobox (
pkey1 text,
pkey2 text,
id timeuuid,
name text,
memo text,
date timestamp,
PRIMARY KEY ((pkey1, pkey2),id,name)
) WITH CLUSTERING ORDER BY (id DESC,name DESC);
And I registered the following data.
INSERT INTO memobox (pkey1,pkey2,id,name,memo,date) VALUES ('a','b',now(),'tanaka','greet message1','2016-12-13');
INSERT INTO memobox (pkey1,pkey2,id,name,memo,date) VALUES ('a','b',now(),'yamamoto','greet message2','2016-12-13');
The following will succeed
SELECT * FROM memobox where pkey1='a' and pkey2='b' ORDER BY id;
However, the following will fail. I would like to ask your professor what is wrong.
SELECT * FROM memobox where pkey1='a' and pkey2='b' ORDER BY name;
■error
cqlsh:keyspaceb> SELECT * FROM memobox where pkey1='a' and pkey2='b' ORDER BY name;
InvalidRequest: code=2200 [Invalid query] message="Order by currently only support the ordering of columns following their declared order in the PRIMARY KEY"
cqlsh:keyspaceb>