Cassandra CQL not equal operator on any column

Gargee Banerjee picture Gargee Banerjee · Oct 15, 2013 · Viewed 39.6k times · Source

Hi is there any way I can use != operator using CQL in Cassandra? I am trying to use a != operator on my columnfamily but when I try using that it says:

cqlsh:EPCContent> select * from "MediaCategoryGroup" where "MCategoryID"!=1;

I get this error:

Invalid syntax at line 1, char 55
  select * from "MediaCategoryGroup" where "MCategoryID"!=1;
                                                        ^

Answer

emgsilva picture emgsilva · Oct 15, 2013

If you look at the Cassandra SELECT syntax, you will see that the WHERE clause must be "composed of relations on the columns that are part of the PRIMARY KEY and/or have a secondary index defined on them." Does your column conform to that specification?

Just for your information this is the full list of relation operators: '=' | '<' | '>' | '<=' | '>=' | '!=' | IN | CONTAINS | CONTAINS KEY.