So here is my stripped table from the messages module of an app I'm writing.
when I run the following command it goes as expected
SELECT * FROM
messages
WHERE to_user = 1 OR from_user = 1 GROUP BY from_user
returns
The drama is that I want to have just one instance of 2 | 1 or 1 | 2 , since in my app I'm trying to group the messages based on the username that has sent the message. I tried without the OR clause, but then when 1 send a message to 2 the message does not appear until he gets a reply from 2. 1 and 2 are dynamic from php variables