Answer the question
In order to leave comments, you need to log in
How to display correspondence in pairs?
Hello!
There is a table " messages " (id, from_id, to_id, message, read, timestamps)
And I need to display the correspondence between users by pair.
My query turns out like this:
Message:where('from_id', $id)->orWhere('to_id', $id)->get();//получаем кому он отправлял и от кого получал
Answer the question
In order to leave comments, you need to log in
SELECT * FROM message WHERE (from=1 AND to=2) OR (from=2 AND to=1)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question