I have table messages
| id | user_id | recepient_id | message
| 1 | 1 | 2 | test1
| 2 | 1 | 2 | test2
| 3 | 2 | 1 | test3
| 4 | 3 | 1 | test4
| 5 | 3 | 2 | test5
I am user with id 1 and want to select rows where i am is a user_id or recepient_id (but only 1 row per user_id/recepient_id pair). It this example i want to select messages with ids - 2, 4 (or 1, 4 or 2, 3 or 2, 4. doesnt matter. just get uniq pairs for user_id/recepient_id)
How can i do it?