Reputation: 4330
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?
Upvotes: 3
Views: 12901
Reputation: 100175
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.
Upvotes: 7