Re: How to write this query!

Поиск
Список
Период
Сортировка
От Richard Huxton
Тема Re: How to write this query!
Дата
Msg-id 200307211246.02554.richardh@archonet.com
обсуждение исходный текст
Ответ на How to write this query!  (Jo <joacn@yahoo.co.uk>)
Список pgsql-sql
On Sunday 13 July 2003 17:32, Jo wrote:
> These are my PostgreSQL tables:
>
> pid | name
>  1  |  A
>  2  |  B
>  3  |  C
>  4  |  D
>  5  |  E
>
> tid | pid 1 | pid 2 | pid 3
> 1   |  1    |  2    |  3
>
> Bascially, I would like to write a query to list only
> the names which their "pid" match those pids in the
> other table. If anyone knows, pls help!!

Jo - not sure how your message took this long to reach the list, but it 
doesn't look like someone has answered, so...

SELECT DISTINCT a.name FROM table_a AS a, table_b as b WHERE a.pid=b.pid1 OR 
a.pid=b.pid2 OR a.pid=b.pid3;

--  Richard Huxton Archonet Ltd


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

Предыдущее
От: "vijaykumar M"
Дата:
Сообщение: Why their is a limit in Postgresql (psql) Parameters..?
Следующее
От: Richard Huxton
Дата:
Сообщение: Re: Why their is a limit in Postgresql (psql) Parameters..?