I have the following table. It stores messages that each user sent and received in chats. I want to select all the messages that the user sent and received, and receive them. Then I can sort them by their conversation id in JQUERY. Should I make two queries for this or can I embed the query? Essentially, I want to do
SELECT * FROM chatbox WHERE sender=?
and
SELECT * FROM chatbox WHERE receiver=?
I just want to try to avoid two queries and two loops for the results. Anyone have any suggestions?
source
share