Find all parents.

Dúvidas, dicas e truques de SQL, Select, Update, Delete, cláusulas, operações com joins, Funções em SQLs, etc
  

Poston Thu, 25 Oct 2007 1:41 pm

Hey everybody, I'm new around here and would like to know how do I find the parents and children in just one query: Ex.: I have a table \"tab_1\" that has a FK to the table \"tab_2\", and this tab_1 is the column's FK daughter on tab_2.

So what I wanted was the following, a query that returns the whole family both up (parents, grandparents) or downwards (children, grandchildren) thanks in advance: shock: att.
Raphaelbi
Location: Rio de Janeiro - RJ

Raphael Porto

Poston Thu, 25 Oct 2007 1:45 pm

Brother, take a look at the end of this topic: http://www.glufke.net/oracle/viewtopic.php?t=2056
Trevisolli
Location: Araraquara - SP

Abraço,

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

Poston Thu, 25 Oct 2007 1:53 pm

Oops, thanks for your help, but what is happening is as follows, I can't see his family up and down, I see only the family up.

I wonder if there would be some way I doing a PL??

Because I have just the tab_2 information of father and daughter, soon I searching for the daughter's father, and later seek new in the child column with the value of the old Daddy, and her grandmother, but how come the whole family in a single query ta brabo,:(

Cheers Att.
Raphaelbi
Location: Rio de Janeiro - RJ

Raphael Porto

Poston Thu, 25 Oct 2007 1:54 pm

Brother, a way out is to do with dynamic SQL.
Do a search here, you're going to find interesting topics.
Sure how to do this quest you want to.
qualquer thing, says ai.
Trevisolli
Location: Araraquara - SP

Abraço,

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

Poston Thu, 25 Oct 2007 2:40 pm

Raphaelbi, an idea would you create a view by tying the 2 tables, then you can mount a select using the \"CONNECT BY\", this may be a way.
Note: the forum has information about the connect by.

[] s
Tineks
Location: Araraquara - SP

Cristiano (Tineks)
Araraquara - SP

Poston Sat, 27 Oct 2007 8:20 am

Kara ... put the structure of your tables ... put there for us the script that you used for these tables! =) vlw!
Renan Orati
Location: São José do Rio Preto - SP

Poston Mon, 29 Oct 2007 9:18 am

Thanks for the help guys Flaa, but I managed to connect by prior Abs
Raphaelbi
Location: Rio de Janeiro - RJ

Raphael Porto


  • See also
    Replies
    Views
    Last Post


Return to SQL

Who is online

Users browsing this forum: No registered users and 2 guests