下面的查询会加载所有对话,但是,我只想加载两个人之间的对话。
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