Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Parent / child sorting problem
Message
 
 
À
14/06/2010 09:12:02
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
Divers
Thread ID:
01468767
Message ID:
01468798
Vues:
36
>That is correct. That is the problem I am asking for assistance with. I do not expect any single SELECT to do the work.
>
>>>No I do not. Since I am interested in how to process this file in order, I am only concerned about its records.
>>>
>>>However, if a solution required that in order to work, I could certainly add the records (the file does not yet exist, but will shortly)
>>>
>>What do you have in ParentID field for parents (or do you plan to have).
>>
>>If parents have NULLs in the ParentID field, it's easy to separate parents from children. However, if you want to order your records in the order by generations (Grandparents - parents - children - grandchildren) then I don't think there is a way in VFP to do so in one select statement. You need recursive function here and create a new table with extra field showing the number in the generations chain.

In SQL Server you can do this with just one select statement

Check some samples here http://blogs.lessthandot.com/index.php/DataMgmt/DataDesign/cte-and-hierarchical-queries
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform