I am using Codeigniter to fire a query on my db. The code looks like:
$this->db->select("category.Name,
booking.Comment,
CASE WHEN amount > 0 THEN amount END AS PosAmount,
CASE WHEN amount < 0 THEN amount END AS NegAmount");
But I always get an
You have an error in your SQL syntax ... right syntax to use near
'WHEN amount > 0 THEN amount END AS PosAmount, `CASE` WHEN amount < 0
THEN amount' at line 1
Codeigniter is escaping the CASE but I do not know how to prevent this.
Any ideas?