Querying a list of values

From: Aarni Ruuhimäki <aarni(at)kymi(dot)com>
To: <pgsql-novice(at)postgresql(dot)org>
Subject: Querying a list of values
Date: 2004-11-18 12:38:52
Message-ID: 200411181438.52982.aarni@kymi.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

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
--------------

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Vishal Kashyap @ [SaiHertz] 2004-11-18 12:49:48 Re: Querying a list of values
Previous Message Gaetano Mendola 2004-11-18 10:37:29 Re: upgrade from postgres 7.3.2