0
我需要做的是這樣的SQL查詢,但在笨SQL查詢:與像和或組合
SELECT `table`.* FROM (`table`) WHERE `name` LIKE '%9%' OR `id` LIKE '%9%' AND (`name` LIKE '%f%' OR `id` LIKE '%f%')
我試圖做絲毫此代碼:
$this->db->select('table.*');
$this->db->from('table');
foreach($data as $d){
$this->db->like("name", $d)
$this->db->or_like("id", $d);
}
但結果在SQL是:
SELECT `table`.* FROM (`table`) WHERE `name` LIKE '%9%' OR `id` LIKE '%9%' AND `name` LIKE '%f%' OR `id` LIKE '%f%'
感謝