Search Postgresql Archives

Reg: Nested query

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux