我有一个页面,用户可以在其中发布消息。对于发布的每条消息,有人可以做出回复,该回复将在原始消息之后立即显示。
查看我的 MySQL 表:
id | user_id | message | date | second_reply_id
1 48 Hi i post a message 2013-08-08 13:00:00 0
2 20 Hi i also post a message 2013-08-08 14:00:00 0
3 17 And i reply to message 1 2013-08-08 15:00:00 1
4 8 And i reply to message 2 2013-08-08 16:00:00 2
5 10 Hi i post a new message 2013-08-08 17:00:00 0
6 7 i reply to reply id 3 2013-08-08 18:00:00 1
有没有办法像这样订购选择查询的结果:
id | user_id | message | date | second_reply_id
5 10 Hi i post a new message 2013-08-08 17:00:00 0
2 20 Hi i also post a message 2013-08-08 14:00:00 0
4 8 And i reply to message 2 2013-08-08 16:00:00 2
1 48 Hi i post a message 2013-08-08 13:00:00 0
3 17 And i reply to message 1 2013-08-08 15:00:00 1
6 7 i reply to reply id 3 2013-08-08 18:00:00 1
谢谢