question on SELECT using LIKE

Поиск
Список
Период
Сортировка
От Aggarwal , Ajay
Тема question on SELECT using LIKE
Дата
Msg-id 913D1DA53416D411835000508BC244C2032C9A@cbsvr1.crossbeamsys.com
обсуждение исходный текст
Ответы RE: question on SELECT using LIKE
Список pgsql-general
Please respond to ajay@crossbeamsys.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@crossbeamsys.com as well.

Ajay

В списке pgsql-general по дате отправления:

Предыдущее
От: Justin Foster
Дата:
Сообщение: Re: Memory Leak
Следующее
От: KuroiNeko
Дата:
Сообщение: Re: where to find postgresql jobs in the Washington, DC area??