Re: [HACKERS] Reg: Nested query

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: [HACKERS] Reg: Nested query
Дата
Msg-id 20081201193805.GH4459@alvh.no-ip.org
обсуждение исходный текст
Список pgsql-sql
Hi,

It's poor manners to crosspost questions to such a huge number of lists,
particularly when there is one among them that perfectly suits your
question.

Vignesh Raaj escribió:
> Can anyone please help in getting a solution...
> I have two table, 1 contains all details of a person with person id as
> primary key.
> the other table has person id and parent id both referring to person table
> person id.
> My query is i have to get all the parents of a given person name.
> Please help me in finding a query solution...

You can't do it short of writing a function that recurses, or using such
tricks as contrib/ltree.  In the upcoming 8.4 version you will be able
to write queries with the WITH RECURSIVE construct to handle this
directly in SQL.

-- 
Alvaro Herrera                                http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support


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

Предыдущее
От: Steve Crawford
Дата:
Сообщение: Re: wired behaviour
Следующее
От: Milan Oparnica
Дата:
Сообщение: Re: JOIN results of refcursor functions