Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SELECT Statement
Message
From
08/01/2001 13:25:23
 
 
To
08/01/2001 13:19:19
Cindy Winegarden
Duke University Medical Center
Durham, North Carolina, United States
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00460633
Message ID:
00460695
Views:
10
Cindy and Dore,

How do your solutions result in the second example given? Looks to me like they would create the first example.

Dave

>>>If I have the following records in a table.
>>>
SID Desc  PID   LX
>>>1....A....0....0
>>>3....B....1....1
>>>5....C....3....2
>>>7....D....5....3
>>>8....E....14...3
>>>14...F....3....2
>>>21...G....3....2
>>>22...H....21...3
>>>
>>>and I want to sort so the table looks like a tree structure
>>>
>>>
SID Desc  PID   LX
>>>1....A....0....0
>>>3....B....1....1
>>>5....C....3....2
>>>7....D....5....3
>>>14...F....3....2
>>>8....E....14...3
>>>21...G....3....2
>>>22...H....21...3
>>>
>>>SID - Structure ID
>>>PID - Parent ID
>>>LX - Level in the tree
>>>
>>>Could this be done using a select statement? Any help or suggestion is appreciated.
>>>
>>>Thanks
>>SELECT * FROM sometable ORDER BY sid
>
>Or, in case there are some repeats in the other fields,
SELECT Sid, Desc, Pid, Lx ;
>  FROM MyTable ;
>  INTO CURSOR MyCursor ;
>  ORDER BY Sid, Desc, Pid, Lx
>
>Matthew - be sure to re-arrange the field names and ordering, and to test with enough repeating fields to get what you want.
David Stevenson, MCSD, 2-time VFP MVP / St. Petersburg, FL USA / david@topstrategies.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform