I am building a messaging system similar to facebook's (where it displays messages as threads).
Basically I need to specify at least 1 member id in order to retrieve from the list. So either it's the "to" column so that you're able to get messages you've received from a specific member or use the "from" column in order to retrieve messages sent to you. Either or, the command must specify a member ID somewhere and be able to filter out the duplicate entries.
In this case: https://i.stack.imgur.com/C6liw.png Since i'm member ID 1, i want to be able to retrieve the messages sent to me, but filtering out the duplicate messages sent to me by user ID 50.
So that the end result becomes something like: https://i.stack.imgur.com/eIghG.png
My current function is:
SELECT * FROM `cometchat` WHERE `to` = 1 or `from` = 1 ORDER BY `sent` DESC
This is the output of the above code: i.imgur.com/zQhNNcu.png
What am I doing wrong?