I have a message board and would like to delete all messages that are older than 2 months. I also want the replies to that message deleted at the same time. The problem I have is deleting the replies. I know that to delete messages over 2 months I would just write(pseudocode):
DELETE FROM table
WHERE date > 2 months
But the replies won't necessarily be over 2 months old. Is there someway to group the original message with its replies? Here are the entries in my table.
ID - Autonumber
MessageId
DateOfPost
Subject
Message
Messages are assigned a MessageId like so:
Original message is 0001
reply to this message would be 0001.01
a second reply to the original mess. would be 0001.02
a third 0001.03, etc.
a reply to the first reply would be 0001.01.01 and on down the line.
I'm new at SQL so please be as descriptive as possible in your answer. Much Thanks.
Jessica
DELETE FROM table
WHERE date > 2 months
But the replies won't necessarily be over 2 months old. Is there someway to group the original message with its replies? Here are the entries in my table.
ID - Autonumber
MessageId
DateOfPost
Subject
Message
Messages are assigned a MessageId like so:
Original message is 0001
reply to this message would be 0001.01
a second reply to the original mess. would be 0001.02
a third 0001.03, etc.
a reply to the first reply would be 0001.01.01 and on down the line.
I'm new at SQL so please be as descriptive as possible in your answer. Much Thanks.
Jessica