Find all parents.

Dúvidas, dicas e truques de SQL, Select, Update, Delete, cláusulas, operações com joins, Funções em SQLs, etc
Post Reply
Raphaelbi
Rank: Estagiário Pleno
Rank: Estagiário Pleno
Posts: 4
Joined: Thu, 25 Oct 2007 1:35 pm
Location: Rio de Janeiro - RJ
Raphael Porto

Speak guys, I'm new here and I would like to know how I do to find parents and children in just one appointment:

Ex.: I have a table "tab_1" which has an FK with The "tab_2" table, and this FK of Tab_1 is the daughter column in Tab_2.

Then what I wanted was the following, an appointment that returns all the family both up (parents, grandparents), and down (children, grandchildren)
99] Thanks

from now

: Shock:

Att.
Trevisolli
Moderador
Moderador
Posts: 2016
Joined: Wed, 12 Jan 2005 3:25 pm
Location: Araraquara - SP
Abraço,

Trevisolli
OCA Oracle PL/SQL Developer Certified Associate
OCP Oracle Forms Developer Certified Professional
Araraquara-SP

Brother,

Take a look at the end of this topic:
http://en.glufke.net/oracle/viewtopic.php?t=2056
Raphaelbi
Rank: Estagiário Pleno
Rank: Estagiário Pleno
Posts: 4
Joined: Thu, 25 Oct 2007 1:35 pm
Location: Rio de Janeiro - RJ
Raphael Porto

Oops, thanks for the help, but what is happening is the following, I can not see the family up and down, I only see the family up.

Is there any way out by making an PL ???

For Tab_2 I have only the information of the father and daughter, soon I seek for the daughter comes the father, and then I seek again in the column son with the value of the old father, and I think Grandmother, but how to make the whole family come in a single consultation ta brabo, :(

Abra

att.
Trevisolli
Moderador
Moderador
Posts: 2016
Joined: Wed, 12 Jan 2005 3:25 pm
Location: Araraquara - SP
Abraço,

Trevisolli
OCA Oracle PL/SQL Developer Certified Associate
OCP Oracle Forms Developer Certified Professional
Araraquara-SP

Brother,

An output is to do with dynamic SQL.
Make a search here, which will find interesting topics.
Surely you have how to do this search you want.
Whatever, send it there.
Tineks
Rank: DBA Sênior
Rank: DBA Sênior
Posts: 365
Joined: Tue, 24 May 2005 2:24 pm
Location: Araraquara - SP
Cristiano (Tineks)
Araraquara - SP

Raphaelbi,

An idea would be to create a view tying the 2 tables, then you can set up a select using the "Connect by", that maybe a path ..
: In the forum you have information about Connect BY.


Renan Orati
Rank: Analista Júnior
Rank: Analista Júnior
Posts: 90
Joined: Thu, 23 Aug 2007 3:40 pm
Location: São José do Rio Preto - SP

Kara ... put here the structure of your tables ... put there for us the script that you used for these tables! =) Vlw !!
Raphaelbi
Rank: Estagiário Pleno
Rank: Estagiário Pleno
Posts: 4
Joined: Thu, 25 Oct 2007 1:35 pm
Location: Rio de Janeiro - RJ
Raphael Porto

Flaa Galera Even for help, but I got through the Connect by prior
ABS
Post Reply
  • Information
  • Who is online

    Users browsing this forum: No registered users and 9 guests