1
我有一個內如下聯接查詢,笨內連接未按預期
SELECT * FROM shop_offer so INNER JOIN shop s ON s.shop_id = so.shop_id INNER JOIN city c ON c.city_id = s.city_id INNER JOIN locality l ON l.locality_id = s.locality_id INNER JOIN category ca ON ca.category_id = s.category_id WHERE so.offer_discount >= 10 AND so.publish = 1
在執行中的phpmyadmin上面的查詢,其結果示出作爲預期只有一行。
但是,當我在codeigniter中嘗試此查詢,結果顯示3行。我的密碼是
$this->db->select('*');
$this->db->from('shop_offer as so');
$this->db->join('shop as s', 's.shop_id = so.shop_id');
$this->db->join('city as c', 'c.city_id = s.city_id');
$this->db->join('locality as l', 'l.locality_id = s.locality_id');
$this->db->join('category as ca', 'ca.category_id = s.category_id');
$this->db->where(array('so.offer_discount >=' => 10, 'so.publish' => 1));
$query = $this->db->get();
codeigniter代碼中存在什麼問題。我是codeigniter中的新成員。有什麼辦法來解決這個錯誤。