0

The following is a simplified table structure showing messages belonging to a single mail trail. i.e. the trail started with messageID 46 (where parentMessageID = 0). Message 47 is a reply to message 46. Message 89 is a reply to message 47.

tblMessages

messageID     parentMessageID
-----------------------------
46            0
47            46
89            47

The table would obviously have thousands of message records.

How would you query the table to get all messages in a particular trail, e.g. the trail shown above?

4

1 回答 1

1

存储对话标识符不是更好吗?

您将遇到的问题是您没有深度级别的指示,因此尝试循环几乎是不可能的。parentMessageID将 设置为最根(即它的位置)会更合乎逻辑parentMessageID == 0,然后按日期对它们进行排序。

于 2013-07-24T10:41:49.977 回答