Return to Snippet

Revision: 17411
at September 3, 2009 17:57 by AzizLight


Initial Code
// CodeIgniter snippet
//+0 is my sneaky way of tying to force numeric sorting on non-numeric fields
$this->db->order_by('dateIssued DESC, invoice_number+0 DESC');

// MySQL snippet
// SELECT * FROM SampleData ORDER BY data_char+0;

Initial URL
http://derekallard.com/blog/post/mysql-natural-sort-order-by-on-non-numeric-field-type/

Initial Description


Initial Title
MySQL Natural Sort Order By on Non-Numeric Field Type

Initial Tags
mysql, codeigniter

Initial Language
PHP