Welcome Guest, Not a member yet? Register   Sign In
ActiveRecord binary order
#1

[eluser]Bikun[/eluser]
Is it possible to make "ORDER BY BINARY col_name" using ActiveRecord?

Code:
$this->db->select('c.id, ct.category');
$this->db->join('categories_translation AS ct', 'ct.parent_id = c.id AND ct.lang = "'.$this->lang->lang().'"', 'left', false);
$this->db->orderby('BINARY ct.category', 'asc', false);
$data['categories'] = $this->db->get('categories AS c');

This code still generates SQL with backticks around BINARY.
#2

[eluser]Bikun[/eluser]
Issue is still open ... Anybody?
#3

[eluser]InsiteFX[/eluser]
Did you try it without the word BINARY?

Enjoy
InsiteFX
#4

[eluser]Bikun[/eluser]
[quote author="InsiteFX" date="1249333493"]Did you try it without the word BINARY?

Enjoy
InsiteFX[/quote]
Yes, without BINARY it works well. Unfortunately I need it to be BINARY order.
#5

[eluser]InsiteFX[/eluser]
Code:
$this->db->orderby('BINARY ct.category', 'asc', false);

Code:
MySQL ORDER BY BINARY col_name

You may have to use MySQL.

Ok I see the problem now, take out the , FALSE

Code:
order_by('BINARY ct.category', 'asc');
orderby just calls order_by with 2 parameters

Enjoy
InsiteFX
#6

[eluser]Bikun[/eluser]
Thanks a lot, it works now perfectly Tongue
#7

[eluser]InsiteFX[/eluser]
Hi,

Your very welcome.

Enjoy
InsiteFX




Theme © iAndrew 2016 - Forum software by © MyBB