title: SQL getting multiple results
body: <p>Alright so I've got this query </p>
  
  <pre><code>SELECT DISTINCT private_messages.*,
                              users.ID AS userID,
                              users.username AS username,
                              profiles.img_url AS profileImage
                              FROM private_messages
                              INNER JOIN users ON users.username = private_messages.receiver
                              INNER JOIN profiles ON profiles.userID = users.ID
                          WHERE private_messages.sender ='Admin'
                          AND  private_messages.id IN  ( select max(ID) 
                          FROM private_messages GROUP BY sender 
                  )                
                  ORDER BY private_messages.sent_at DESC 
  </code></pre>
  
  <p>Now the query works fine BUT I want to get results for both sender and receiver, is that even possible?</p>
  
  <p>For example this query filters "unique" messages that were sent by Admin but I also want to check for those he received. </p>
  
  <p>So basically I want to alter this query to do things bellow</p>
  
  <ul>
  <li>List ALL private messages user received AND sent and make sure that they are unique</li>
  </ul>
  
  <p>By Unique I basically mean I dont want to see some message that I've sent to someone and they just responded to me, I want to see only 1 message from each person</p>
  
  <p>this is what I get from the current query
  <a href="https://i.stack.imgur.com/btjRn.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/btjRn.png" alt="enter image description here"></a></p>