I have a custom query like this
SELECT `wo_number`,`request_date`,`wo_type`,`requestor`
FROM `work_orders`
WHERE CONCAT(",", `assigned_to_enggs`, ",") REGEXP ",(21),"
It works fine for me I want to use it in Codeigniter Active Record. I have tried something like
$this->db->select('wo_number,request_date,wo_type,requestor')
->from('work_orders')
->where("CONCAT(',', assigned_to_enggs, ',') REGEXP ',(21),'");
Don't know what I am doing wrong in syntax. can someone guide me. Thanks
SELECT `wo_number`, `request_date`, `wo_type`, `requestor` FROM `work_orders` WHERE CONCAT(',', assigned_to_enggs, ',') REGEXP ',(21),'How is your built query rendered? We don't know. Are you using the correct db driver to suit your database dialect? Notice the difference between your raw query with double-quoted values versus thewhere()method where you have hardcoded single-quotes around values.