Welcome Guest, Not a member yet? Register   Sign In
two order by clause in sql query
#5

[eluser]core-coder[/eluser]
[quote author="Armchair Samurai" date="1267189924"]Assuming you mean CI Active Record, just call order_by() two times, once for each clause, just pass your own string to order_by().

Code:
$this->db->order_by('categories_order', 'asc');
$this->db->order_by('categories_name', 'asc');

$query = $this->db->get('categories');

// OR

$this->db->order_by('categories_order ASC, categories_name ASC');

$query = $this->db->get('categories');
[/quote]

Thanks I got it by $this->db->order_by('categories_order ASC, categories_name ASC');


Messages In This Thread
two order by clause in sql query - by El Forum - 02-26-2010, 01:05 AM
two order by clause in sql query - by El Forum - 02-26-2010, 01:08 AM
two order by clause in sql query - by El Forum - 02-26-2010, 01:12 AM
two order by clause in sql query - by El Forum - 02-26-2010, 01:12 AM
two order by clause in sql query - by El Forum - 02-26-2010, 01:14 AM



Theme © iAndrew 2016 - Forum software by © MyBB