message table

From: none <invalid_at_nowhere.com>
Date: Sat, 19 Sep 2015 08:52:40 +0200
Message-ID: <55fd0639$0$9224$426a74cc_at_news.free.fr>



Hi,

I have a simple table that records messages sent between 2 users like:

+----+------+----+--------+-------+

| id | from | to | msg | date |
+----+------+----+--------+-------+

| 0 | A | B | "msg1" | date1 |
+----+------+----+--------+-------+

| 1 | A | C | "msg2" | date2 |
+----+------+----+--------+-------+

| 2 | C | B | "msg3" | date3 |
+----+------+----+--------+-------+

| 3 | A | B | "msg4" | date4 |
+----+------+----+--------+-------+

| 4 | D | A | "msg5" | date5 |
+----+------+----+--------+-------+

And so on…

My issue is with having almost the same meaning in the fields "from" and "to".

Getting all messages where 'A' is the sender is straightforward but what kind of construction would you advise me to get for example:

Thanks for any response/idea/hint! Received on Sat Sep 19 2015 - 08:52:40 CEST

Original text of this message