これはかなり単純なはずですが、私はそれに固執しています。
クエリを実行するとき
SELECT * FROM `inbox` where toid=4 or fromid=4 order by time desc
、私は得る:
id  toid    fromid  message           time
23  48101   4   hello call me     12/23/2011 12:27
6   34584   4   hi there      12/22/2011 15:42
5   34584   4   how are you   12/22/2011 14:08
4   34584   4   say hello     12/22/2011 14:07
3   34584   4   whats up      12/22/2011 14:07
2   4   34584   nice picture      11/24/2010 0:00
1   4   2   this is very interesting!   12/23/2008 0:00
ここで、ユーザー 4 と他のユーザーの間の会話を、最後のメッセージを含む 1 つの行にグループ化する必要があります (Facebook のメッセージのように)。
誰かがそれを行うための最良の方法を知っていますか?
ありがとうございました!