Information générale
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Not quite clear what is the parent table, how many child and grand-child tables do you have, and what are their keys.
This could be one of the solutions:
select Parent.field1, child.field1,grandchild.field1 from Parent, child, grandchild where parent.key=child.key and child.key1=grandchild.key1 ;
union;
select Parent.field1, child.field1,space(len(grandchild.field1)) from ;
Parent, child where parent.key=child.key and child.key1 NOT in ;
(select key1 from grandchild);
order by 1,2,3
>hi
>
>i've a table structure (recursive) like this
>
>Seq --descr ----------pseq ---lvl
>1-----Master -------- 0 ------0
>2-----customer------- 1 ------1
>3-----supplier------- 1 ------1
>4-----Customer List-- 2 ------2
>5-----Supp. List----- 3 ------2
>
>now i want the desired result like this
>
>Seq --descr ----------pseq ---lvl
>1-----Master -------- 0 ------0
>2-----customer------- 1 ------1
>4-----Customer List-- 2 ------2
>3-----supplier------- 1 ------1
>5-----Supp. List----- 3 ------2
>
>means that the Parent then list of child and if any child has further child then it should come right under it and so on for all the record. the heirarchy should be in a sequence of parent --> child --> child .... and so on
>
>Thanks in advance
>Anwar
Précédent
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement