question on SELECT using LIKE

From: "Aggarwal , Ajay" <ajay(at)crossbeamsys(dot)com>
To: "'pgsql-general(at)postgresql(dot)org'" <pgsql-general(at)postgresql(dot)org>
Subject: question on SELECT using LIKE
Date: 2000-11-02 22:32:12
Message-ID: 913D1DA53416D411835000508BC244C2032C9A@cbsvr1.crossbeamsys.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Please respond to ajay(at)crossbeamsys(dot)com since I don't subscribe to the
mailing list.

I have 2 tables :

Table1
Name Age
joe 23
mark 25
linda 22

Table2
NameList Group
joe group1
mark group2
joe linda group3

For each person in Table1, I want to list the groups that he/she is a member
of. Table2 has the group membership information, but notice that the first
column of Table2 is a list of names rather than a single name.

I want to be able to use the the following SELECT call :

SELECT t1.name, t2.group
FROM table1 t1, table2 t2
WHERE t2.namelist LIKE %t1.name%;

But its not working. The problem is in '%t1.name%', the second operand of
LIKE.

Thanks in advance. Please Cc your reply to ajay(at)crossbeamsys(dot)com as well.

Ajay

Responses

Browse pgsql-general by date

  From Date Subject
Next Message The Hermit Hacker 2000-11-03 04:23:51 Re: the List! the List
Previous Message Tom Lane 2000-11-02 21:40:22 Re: Does this table exist?