Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Parent / child sorting problem
Message
 
 
To
14/06/2010 08:39:59
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
Miscellaneous
Thread ID:
01468767
Message ID:
01468771
Views:
58
Wouldn't 'ORDER BY ChildID, ParentID' give you desired result?

>I have an interesting sorting problem:
>
>I have a table with three fields: ParentID, ChildID, and SortKey
>
>ParentID and ChildID are both PKs from another table. Any of the PKs from that table may appear any number of times as a ParentID, and any number of times as a ChildID.
>
>What I'm looking for is a way to assign SORTKEY so that I can process this table in the order I want, which is this --
>
>I want all occurrences of any PK as a ChildID to precede any occurrences of that same PK as a ParentID. Stated another way -- I want to have all the first generation PKs at the top, followed by all second generations, etc. Thus, when sorted, I will know that each ParentID I encounter will not be referenced later as a childID.
>
>There is some possibility with circularity here, of course, and I'm hoping that any solution might help that this issue as well.
>
>Thanks in advance.
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform