Welcome Guest, Not a member yet? Register   Sign In
Using MySQL find_in_set with activerecord order_by
#1

[eluser]Unknown[/eluser]
Hey there!

I already searched the forum and googled for it, but I didnt find anything.

The problem is when I try to use find_in_set in an order_by statement, it tries to escape my query, just like it happens in the SELECT, but when thats the case, you can use the "FALSE" parameter to make it work.

Does anybody know how to do that with the order_by?

The code:
$this->db->order_by('find_in_set(id_status, "3,1,2")')

The result:
ORDER BY find_in_set(id_status, `"3`, `1`, `2"` )

I even tried:
$this->db->order_by('find_in_set(id_status, "3,1,2")', FALSE)
AND
$this->db->order_by('find_in_set(id_status, "3,1,2")', 'ASC', FALSE)




Theme © iAndrew 2016 - Forum software by © MyBB