Re: Check a column value not in Array.

From: "Pavel Stehule" <pavel(dot)stehule(at)gmail(dot)com>
To: emilu(at)encs(dot)concordia(dot)ca
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Check a column value not in Array.
Date: 2008-08-14 19:31:23
Message-ID: 162867790808141231m63754721gadc375add2b68b7c@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hello

2008/8/14 Emi Lu <emilu(at)encs(dot)concordia(dot)ca>:
> Greetings,
>
> May I know the command to check whether a column value is in array please?
>
> For example, I am looking for sth like:
>
> select *
> from test
> where test.col not in ARRAY['val1', 'val2'];
>
> Thanks!

postgres=# select 1 = any(array[1,2,3]);
?column?
----------
t
(1 row)

postgres=# select 4 = any(array[1,2,3]);
?column?
----------
f
(1 row)

Regards
Pavel Stehule

>
> --
> Sent via pgsql-sql mailing list (pgsql-sql(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-sql
>

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Filip Rembiałkowski 2008-08-14 19:31:41 Re: Check a column value not in Array.
Previous Message Emi Lu 2008-08-14 19:07:13 Check a column value not in Array.