Posted By

AzizLight on 09/03/09


Tagged

mysql codeigniter activerecords


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

umang_nine
dantreacy


MySQL Natural Sort Order By on Non-Numeric Field Type


 / Published in: PHP
 

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

  1. // CodeIgniter snippet
  2. //+0 is my sneaky way of tying to force numeric sorting on non-numeric fields
  3. $this->db->order_by('dateIssued DESC, invoice_number+0 DESC');
  4.  
  5. // MySQL snippet
  6. // SELECT * FROM SampleData ORDER BY data_char+0;

Report this snippet  

You need to login to post a comment.