It seems I am the first on the Internet having a problem with this. So either I am trying something impossible, or I am so stupid that nobody needs to write it down on any homepage.
My problem is some SQL-statement.
I am writing a forum (
www.denemarken.prikbord.franl.dk). I use VBScript / ASP as language, and Microsoft Access 2000 as database. I am having MDAC 2.8 installed on my server.
The table in the database has following fields:
- ID (AutoNumber)
- ReplyID (= 0 if a new message is postet, or "ID" of the original message, if the message is a reply)
- BaseID (ID of the first message in a topic range
- Date
- Time
- Subject
- Text
- IP
- Name
- Email
- Position
All subjects are ordered by reply, which means, that a reply on a message appears in a list right under the original message, with to spaces ( in front of the subject. And if there comes a reply on a reply, it simply adds two more spaces, and appears right under the last message.
Such as these:
Message (ID:1, ReplyID:0, BaseID: 1)
--Re: Message (ID:2, ReplyID:1, BaseID: 1)
----Re: Message (ID:3, ReplyID:2, BaseID: 1)
Now comes the tricky part. Look at this:
Message (ID:1, ReplyID:0, BaseID: 1)
--Re: Message (ID:2, ReplyID:1, BaseID: 1)
----Re: Message (ID:3, ReplyID:2, BaseID: 1)
------Re: Message (ID:4, ReplyID:3, BaseID: 1)
--------Re: Message (ID:5, ReplyID:4, BaseID: 1)
----Re: Message (ID:6, ReplyID:2, BaseID: 1)
------Re: Message (ID:7, ReplyID:6, BaseID: 1)
--------Re: Message (ID:8, ReplyID:7, BaseID: 1)
------Re: Message (ID:9, ReplyID:6, BaseID: 1)
--------Re: Message (ID:10, ReplyID:9, BaseID: 1)
Now my question is: WHICH SQL Statement am I supposed to use? At this moment, I am using
Select ID, ReplyID, Name, Email, IP, Subject, Text, Date, Time, Position, BaseID from forum ORDER BY BaseID, Position, Date, Time ASC
Yours,
Albert van Harten
Denmark