Hari Haran
Hari Haran

Reputation: 1553

OR operation in cassandra cqlsh

SELECT * FROM sample WHERE id = '2' OR uid = '1';

I got the error in cqlsh

Bad Request: line 1:36 missing EOF at 'OR'

Is It possible for or operator in Cassandra using cqlsh client?

Upvotes: 3

Views: 1836

Answers (2)

John
John

Reputation: 1462

While doanduyhai is right in principle, there is the 'IN' operator if you need to restrict on the same column:

cqlsh:demodb> SELECT * FROM sample WHERE id IN ('2','1');

Have a look at the documentation.

The kind of operation that is available to you depends heavily on the data model. I highly recommend the data model section in datastax' documentation.

Upvotes: 4

doanduyhai
doanduyhai

Reputation: 8812

@Hari

OR operation is not supported by CQL. Only AND operation is supported, with some restrictions.

Anyway, CQL language looks similar to SQL but the semantics are very different. I suggest to have a look at the documentation for more details.

Upvotes: 4

Related Questions