Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2000-12-06 : 21:32:29
|
webguru22 writes "Hi SQL gurus, Here's a twist on the old "threaded message board query" question: I need to come up with a data model that will let me have elements in an "outline" with numbered sub-elements." Actually a paraphrased his question quite a bit. You can see the original question in the forums though. Article Link. |
|
kaprice
Starting Member
10 Posts |
Posted - 2001-12-30 : 20:44:57
|
quote: Does this not break when a single hash value in the postkey jumps over 10?You are doing an ORDER BY on a varchar column with data that looks like this:11.11.1.11.2.1
If I understand the code correctly, the recordset that displays the threaded records is from the newly created temp table:Create Table #NestedPosts (SortID int IDENTITY (1,1),PostID int,PostKey varchar(200),PostLevel int )The sp then appends records to this temp table one at a time in the threaded order. The temp table has SortID, which is an IDENTITY column, so it will automatically number these records in the order they are placed. The client code would then use SortID as the OrderBy column, so the 1.1.10.1 scheme you described is for NUMBERING only, not for the OrderBy.(Of course, I could be wrong.)-Keith |
|
|
minou30
Starting Member
2 Posts |
Posted - 2009-05-17 : 20:19:02
|
How to translate this into MYSQL? (Just learning stored procedures in MYSQL 5.0; have yet to find a good reference guide.)Thanks |
|
|
|
|
|