Re: Better way to check more than 1 value NOT IN (...)

From: pasman pasmański <pasman(dot)p(at)gmail(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: Better way to check more than 1 value NOT IN (...)
Date: 2011-09-24 11:54:41
Message-ID: CAOWY8=adSXDV-jJU-qMhGK7sbFyk539TiARHN-o8CP9cMhSfnw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

You can write condition in subquery:

where 0=(select count(*) from myfunction(id) where x in (10,20))

2011/9/24, Andreas <maps(dot)on(at)gmx(dot)net>:
> Hi,
> I've got to check if 2 values are not in a set that is dynamically
> calculated by a function.
>
> The query looks like
>
> select some_id, ....
> from .....
> where 10 is not in ( select x from my_function (some_id))
> and 20 is not in ( select x from my_function (some_id))
>
> Is there a efficiency issue with calculating the set twice ?
> Can I somehow check both (or more) values at once?
>
> --
> 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
>

--
------------
pasman

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message R. Smith 2011-09-25 16:37:22 Re: Sorting of data from two tables
Previous Message Andreas 2011-09-24 09:38:48 Better way to check more than 1 value NOT IN (...)