MySql Query for displaying messages betweeen two users

51 Views Asked by At

I got a unique sender_id and a reciever_id i had a mysql query before like WHERE "sender_id" AND/OR "reciever_id" LIKE "value1" AND/OR "value2" but i cant remember it and figure it out pls need some help ;) Thanks

1

There are 1 best solutions below

3
On

Won't simply doing this work?

SELECT FROM messages WHERE (sender_id=value1 AND receiver_id=value2) OR (sender_id=value2 AND receiver_id=value1)