Skip site navigation (1) Skip section navigation (2)

Re: Querying a list of values

From: Sean Davis <sdavis2(at)mail(dot)nih(dot)gov>
To: aarni(at)kymi(dot)com
Cc: <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Querying a list of values
Date: 2004-11-18 12:54:14
Message-ID: F2FA4E7A-3960-11D9-AD50-000A95D7BA10@mail.nih.gov (view raw or flat)
Thread:
Lists: pgsql-novice
You might want to look at:

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

Sean

On Nov 18, 2004, at 7:38 AM, Aarni Ruuhimäki wrote:

> Hi people,
>
> Is there a / what is the way to query a list of values ?
>
> some_list = '1,2,3,4,5'
>
> some_list could also be null or any length.
>
> <cfif some_list IS NOT NULL>
>
> SELECT some_id, some_name
> FROM some_table
> WHERE some_id = any of the list values of some_list
>
> </cfif>
>
> So that that query would return five rows in this case ?
>
> I can do a cfml-loop around the query according to the list length for 
> each
> value but that means a I do an x number of queries instead of just one.
>
> ??,
>
> Aarni
> --------------
> This is a bugfree broadcast to you
> from **Kmail**
> on **Fedora Core 2** linux system
> --------------
>
> ---------------------------(end of 
> broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to 
> majordomo(at)postgresql(dot)org


In response to

pgsql-novice by date

Next:From: Aarni RuuhimäkiDate: 2004-11-18 13:22:58
Subject: Re: Querying a list of values
Previous:From: Vishal Kashyap @ [SaiHertz]Date: 2004-11-18 12:49:48
Subject: Re: Querying a list of values

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group