以下のクエリはすべての会話を読み込みますが、私は 2 人の会話のみを読み込みたいと考えていました。
SELECT * FROM msg
WHERE senderid = '{$sender}'
OR recid = '{$recipient}'
OR recid = '{$sender}'
OR senderid = '{$recipient}'
order by id asc
AND & OR 演算子を一緒に使用するにはどうすればよいですか? 以下は機能しますか?
SELECT * FROM msg
WHERE senderid = '{$sender}'
AND recid = '{$recipient}'
OR recid = '{$sender}'
AND senderid = '{$recipient}'
order by id asc