2
我有兩個人,用戶222和用戶5555之間的消息會話的MySQL選擇數據的解決方案,它顯示是這樣的:極品那裏,直到
Conversation-ID 1, Message-ID 5, User-ID 222: "Oh, and I'm happy about that!"
Conversation-ID 1, Message-ID 4, User-ID 222: "And bought me a new car."
Conversation-ID 1, Message-ID 3, User-ID 222: "I just won some money!"
Conversation-ID 1, Message-ID 2, User-ID 5555: "Fine, how are you?"
Conversation-ID 1, Message-ID 1, User-ID 222: "Hi there, how are you?"
現在我正在尋找在PHP的解決方案/ MySQL的只顯示來自用戶ID 222的消息,直到從用戶ID 5555。
消息的結果應該是:
Conversation-ID 1, Message-ID 5, User-ID 222: "Oh, and I'm happy about that!"
Conversation-ID 1, Message-ID 4, User-ID 222: "And bought me a new car."
Conversation-ID 1, Message-ID 3, User-ID 222: "I just won some money!"
其實我有
"SELECT * FROM table_conversations WHERE conversation_id='1' and user_id !='5555' ORDER BY message_id DESC"
當然這將顯示我的用戶ID 222.我想是只有最後無應答消息從用戶ID 222
什麼的所有消息,但是否有任何命令或解決方案在php + mysql中獲得這個結果,也適用於所有其他會話?
固定在代碼中的鍵入錯誤,刪除'C'和'c1'和加入對話ID到'選擇max'部分使你的代碼工作。非常感謝你! – lickmycode