Re: Check a column value not in Array.

From: Filip Rembiałkowski <plk(dot)zuber(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:41
Message-ID: 92869e660808141231h73810e9ek93e79fd68547ee8b@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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'];
>

select * from test where test.col <> ALL ( ARRAY['val1', 'val2'] );

see http://www.postgresql.org/docs/current/static/functions-comparisons.html

be careful with NULLs in this type of comparisons.

--
Filip Rembiałkowski

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Andreas Wenk 2008-08-15 07:37:05 Re: Check a column value not in Array.
Previous Message Pavel Stehule 2008-08-14 19:31:23 Re: Check a column value not in Array.