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 -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql