I want a write following query.
SELECT SUBSTRING(zsmonth, 5, 2) as month FROM (`tblsales_month`)
So i wrote following code.
$this->db->select('SUBSTRING(zsmonth, 5, 2) as month')
->from('tblsales_month');
But it generate following query with unnecessary back quote.
SELECT SUBSTRING(zsmonth, `5`, `2)` as month FROM (`tblsales_month`)
What is the best way to do that?
add second parameter FALSE, like:
$this->db->select('SUBSTRING(zsmonth, 5, 2) as month', FALSE)
->from('tblsales_month');
Setting second parameter to FALSE, CodeIgniter will not try to protect your field or table names with backticks.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With