1
我已經檢查對此其他問題與SQL語句或條款,但未能解決問題如何改寫笨
$this->db->where(array('sender_deletedS' => 1, 'receiver_deleted' => 0));
$this->db->or_where(array('sender_deletedS' => 0, 'receiver_deleted' => 1));
$this->db->or_where(array('sender_deletedS' => 0, 'receiver_deleted' => 0));
$query2 = $this->db->get('message');
它產生
SELECT * FROM `message` WHERE `sender_deletedS` = 1 AND `receiver_deleted` =0 OR `sender_deletedS` =0 OR `receiver_deleted` = 1 OR `sender_deletedS` =0 OR `receiver_deleted` =0
,但我想這
SELECT * FROM `message` WHERE `sender_deletedS` = 1 AND `receiver_deleted` =0 OR `sender_deletedS` =0 AND `receiver_deleted` = 1 OR `sender_deletedS` =0 AND `receiver_deleted` =0