Juan M De Sousa
Juan M De Sousa

Reputation: 11

Some type of GROUP BY with COUNT in Cassandra

everyone.

I'm new with Cassandra and I got a question.

I asked for a model... Need to queryng into a column (or collection) in Cassandra

And now, I want to know if there's a way of know how many coincidences match with my query?

In SQL, I can do something like:

SELECT id
       count(1) c
FROM example 
WHERE id = 1 and ((c1 = '1' and c2 = '2') or (c1 = '3' and c2 = '4'))
GROUP BY 
id,
c;

And that's return the id and the count of coincidences of the fields.

If c1 = '3' doesn't exist. The count is 1.

There's a way of do this on Cassandra. I know that GROUP BY don't exist in Cassandra. But, some idea?

Thanks a lot, mates :D

Upvotes: 1

Views: 8170

Answers (1)

curiousguy
curiousguy

Reputation: 3262

Try cassandra 3.10 or later. It supports Group By. Here is an example

Upvotes: 2

Related Questions