Welcome Guest, Not a member yet? Register   Sign In
Active record select query and case
#1

[eluser]Zeff[/eluser]
Hi folks,

In an application I use a simple query to get (and sort asc.) email addresses out of a database table. In the model I use:
Code:
$this->db->select();
$this->db->from('subscribers');
$this->db->orderby('email', 'asc');
$query = $this->db->get();
...

Email addresses are returned sorted, but those in uppercase (or first letter -) come first (nicely sorted alphabetically) and the lower cased addresses follow after the upper case list (also nicely sorted from a-z)...

e.g.
Does anyone know whether this an underlying MySql problem or typical for Active Record class get/orderby?

It would be great if someone can give me a workaround...

Thanks in advance!

Kind regards,

Zeff
#2

[eluser]Cristian Gilè[/eluser]
Code:
$this->db->order_by('lower(email)','ASC');
$query = $this->db->get('subscribers');


Cristian Gilè
#3

[eluser]Zeff[/eluser]
Dear Cristian,

Great solution, works perfect!

Thanks a lot,

Zeff




Theme © iAndrew 2016 - Forum software by © MyBB