Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Parent / child sorting problem
Message
 
 
To
14/06/2010 09:12:02
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
Miscellaneous
Thread ID:
01468767
Message ID:
01468798
Views:
35
>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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform