Kashif Sohail
Kashif Sohail

Reputation: 3

Why does Cassandra OR WHERE clause not work

I am querying the data from "countries" table with or where clause but it is giving me the below error.

line 1:49 mismatched input 'OR' expecting EOF (...countries WHERE alpha2Code = 'PAK' [OR]...)

Here is my query.

SELECT * FROM countries WHERE alpha2Code = 'PAK' OR alpha3Code = 'PAK' allow filtering;

How can i achieve the task to get data with OR WHERE clause?

Upvotes: 0

Views: 422

Answers (2)

M P
M P

Reputation: 300

  1. Cassandra doesn't support OR and you will need to implement the logic in the code by making multiple codes to achieve what you are trying above

  2. Be warned about the use of allow filtering - not a good practice as you are not querying against a column which is filterable by design.

Upvotes: 1

Alb
Alb

Reputation: 1125

Cassandra doesn't support the OR operator. Use a disjunction in your code.

Upvotes: 0

Related Questions