Reg: Nested query

From: "Vignesh Raaj" <vigneshraaj(at)gmail(dot)com>
To: pgsql-hackers(at)postgresql(dot)org, pgsql-www(at)postgresql(dot)org, ukpug(at)postgresql(dot)org, pgadmin-support(at)postgresql(dot)org, pgsql-general(at)postgresql(dot)org, pgsql-sql(at)postgresql(dot)org
Subject: Reg: Nested query
Date: 2008-12-01 18:39:23
Message-ID: ed6e9ae90812011039u6d1964baqdf01b72d222d8cab@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-support pgsql-general pgsql-hackers pgsql-sql pgsql-www

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...

Table "person"
Column | Type |
Modifiers
------------+-----------------------+----------------------------------------------------
pid | bigint | not null default
nextval('"person_pid_seq"'::text)
first_name | character varying(50) |
surname | character varying(50) |
dob | date |
Primary key: person_pkey

Table "parent_of"
Column | Type | Modifiers
-----------+---------+-----------
person_id | integer |
parent_id | integer |

so if i give first_name of person = ????, then i have get all the parent
ids. I tried nested query but tat resulted in 1 level parent alone.
i want to get all parent id... please help me..!

Reagrds,
Vignesh
--
"A man who believes in himself and not circumstances is the real winner"

Responses

Browse pgadmin-support by date

  From Date Subject
Next Message Alvaro Herrera 2008-12-01 19:38:05 Re: [HACKERS] Reg: Nested query
Previous Message Stefan Keller 2008-11-30 20:09:10 Re: Need some informations...

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2008-12-01 18:53:56 Re: Trigger before delete does fire before, but delete doesn't not happen
Previous Message Malinka Rellikwodahs 2008-12-01 18:21:00 Re: db backup script in gentoo

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2008-12-01 18:46:41 Re: New to_timestamp implementation is pretty strict
Previous Message Greg Smith 2008-12-01 17:54:43 Re: Simple postgresql.conf wizard

Browse pgsql-sql by date

  From Date Subject
Next Message Alvaro Herrera 2008-12-01 19:38:05 Re: [HACKERS] Reg: Nested query
Previous Message Steve Crawford 2008-12-01 17:18:50 Re: wired behaviour

Browse pgsql-www by date

  From Date Subject
Next Message Alvaro Herrera 2008-12-01 19:38:05 Re: [HACKERS] Reg: Nested query
Previous Message Guido Barosio 2008-12-01 16:10:49 Re: Who is moderating the news?