I'd like to add that in() is usually a bad idea.  It is convenient, but not
really what you want in production.  Go with Jens' original suggestion of
multiple queries.

I recommend reading Ryan Svihla's post on why in() is generally a bad
thing:
http://lostechies.com/ryansvihla/2014/09/22/cassandra-query-patterns-not-using-the-in-query-for-multiple-partitions/

On Mon, Mar 2, 2015 at 12:36 AM Jens Rantil <jens.ran...@tink.se> wrote:

> Hi Rahul,
>
> No, you can't do this in a single query. You will need to execute two
> separate queries if the requirements are on different columns. However, if
> you'd like to select multiple rows of with restriction on the same column
> you can do that using the `IN` construct:
>
> select * from table where id IN (123,124);
>
> See [1] for reference.
>
> [1]
> http://www.datastax.com/documentation/cql/3.1/cql/cql_reference/select_r.html
>
> Cheers,
> Jens
>
> On Mon, Mar 2, 2015 at 7:06 AM, Rahul Srivastava <
> srivastava.robi...@gmail.com> wrote:
>
>> Hi
>>  I want to make uniqueness for my data so i need to add OR clause  in my
>> WHERE clause.
>> ex: select * from table where id =123 OR name ='abc'
>> so in above i want that i get data if my id is 123 or my name is abc .
>>
>> is there any possibility in cassandra to achieve this .
>>
>>
>
>
> --
> Jens Rantil
> Backend engineer
> Tink AB
>
> Email: jens.ran...@tink.se
> Phone: +46 708 84 18 32
> Web: www.tink.se
>
> Facebook <https://www.facebook.com/#!/tink.se> Linkedin
> <http://www.linkedin.com/company/2735919?trk=vsrp_companies_res_photo&trkInfo=VSRPsearchId%3A1057023381369207406670%2CVSRPtargetId%3A2735919%2CVSRPcmpt%3Aprimary>
>  Twitter <https://twitter.com/tink>
>

Reply via email to