Querying a list field against another list

From: Aarni Ruuhimäki <aarni(at)kymi(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: Querying a list field against another list
Date: 2004-11-26 13:52:31
Message-ID: 200411261552.31041.aarni@kymi.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Hi people,

This is not quite a pg question, but any suggestions are most welcome.

How can one query a list of values against a db field that contains a list of
values ?

Table foo

foo_id | foo_name | da_list
--------------------------------------
1 | x | 1,2,3,4,5
2 | y | 1,4,5
3 | z | 4,5,11
4 | xyz | 14,15,33

As a result from another query I have parameter bar = '1,4' and want to find
all rows from foo where da_list contains '1' or '4'. So loop over bar to loop
over da_list in foo ?

My humble thanks,

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 Kjetil Haaland 2004-11-26 14:56:41 problem with memory allocation
Previous Message Alexander Jochum 2004-11-26 13:18:06 Re: problem with accessing or creating a database..