How to select users in the message table in mysql and order them by date? : I am building messaging module in mysql and PHP. I have a table in which I am saving the messages.
The table for messages has the following colloums.

    
    Index | from | to | date | body 

Now I want to select the users who sent or recived text from a specfic user and order that by date. Please help me!


If I am user 2, Table:

    Index | from | to | date                | body
    1 | user1 | user2 | 2018-06-18 12:51:19 | Hi
    2 | user2 | user1 | 2018-06-18 12:55:19 | Hello

    4 | user3 | user2 | 2018-06-18 12:55:19 | Hi
    5 | user2 | user3 | 2018-06-18 12:56:19 | Hello
    6 | user3 | user2 | 2018-06-19 01:55:19 | bolo
    7 | user2 | user3 | 2018-06-19 02:56:19 | Kya

If I am user 2, Desired data:

      user3 | 2018-06-19 02:56:19
      user1 | 2018-06-18 12:55:19

