You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Timmy Turner <ti...@gmail.com> on 2014/09/29 23:53:38 UTC

Not-Equals (!=) in Where Clause

Looking through the CQL 3.1 grammar for Cassandra 2.1, I noticed that the
not-equals operator (!=) is in the grammar definition, but I can't seem to
find any legal way to use it.

Is != supported as part of the where clause in Cassandra? Or is it the
grammar for some other purpose?

Re: Not-Equals (!=) in Where Clause

Posted by Sylvain Lebresne <sy...@datastax.com>.
Right, my bad, thanks Tyler for the correction.

On Tue, Sep 30, 2014 at 5:44 PM, Tyler Hobbs <ty...@datastax.com> wrote:

> I think Sylvain may not have had his coffee yet.  You can't use IF's in
> SELECT statements, but you can in INSERT/UPDATE/DELETE:
>
> UPDATE foo SET a = 0 WHERE k = 0 IF b != 0;
>
> On Tue, Sep 30, 2014 at 2:36 AM, Sylvain Lebresne <sy...@datastax.com>
> wrote:
>
>>
>>
>>> Is != supported as part of the where clause in Cassandra?
>>>
>>
>> It's not.
>>
>> Or is it the grammar for some other purpose?
>>>
>>
>> It's supported in 'IF' conditions. You can do something like:
>>   SELECT * FROM foo WHERE k = 0 IF v != 3;
>>
>> --
>> Sylvain
>>
>
>
>
> --
> Tyler Hobbs
> DataStax <http://datastax.com/>
>

Re: Not-Equals (!=) in Where Clause

Posted by Tyler Hobbs <ty...@datastax.com>.
I think Sylvain may not have had his coffee yet.  You can't use IF's in
SELECT statements, but you can in INSERT/UPDATE/DELETE:

UPDATE foo SET a = 0 WHERE k = 0 IF b != 0;

On Tue, Sep 30, 2014 at 2:36 AM, Sylvain Lebresne <sy...@datastax.com>
wrote:

>
>
>> Is != supported as part of the where clause in Cassandra?
>>
>
> It's not.
>
> Or is it the grammar for some other purpose?
>>
>
> It's supported in 'IF' conditions. You can do something like:
>   SELECT * FROM foo WHERE k = 0 IF v != 3;
>
> --
> Sylvain
>



-- 
Tyler Hobbs
DataStax <http://datastax.com/>

Re: Not-Equals (!=) in Where Clause

Posted by Sylvain Lebresne <sy...@datastax.com>.
>
> Is != supported as part of the where clause in Cassandra?
>

It's not.

Or is it the grammar for some other purpose?
>

It's supported in 'IF' conditions. You can do something like:
  SELECT * FROM foo WHERE k = 0 IF v != 3;

--
Sylvain