Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Message thread
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Message thread
Miscellaneous
Thread ID:
00907956
Message ID:
00907956
Views:
42
I am trying to create a SQL query to select records from a table and order them the way I want the ordered. I am sure it is possible but I just can't figure it out right now.
Imagine the following table:
nMsgId  nParentId
 1       1
 8       1
10       1
11      10
12       8
13      12
Now i want to run a select statement:
select nMsgId,nParentId from myTable order by ?????
And I would like the following result
nMsgId  nParentId
 1       1
 8       1
12       8
13      12
10       1
11      10
Is this possible to do?
It will be used for a messagethreading system, kinda like UT messages are organized (don't worry I am not thinking about competing with UT <s>).

Should I stop thinking about running a select statement and run a recursive look type thing instead?

Thanks,
Einar
Semper ubi sub ubi.
Next
Reply
Map
View

Click here to load this message in the networking platform