/ Published in: PHP
                    
                                        
                            
                                Expand |
                                Embed | Plain Text
                            
                        
                        Copy this code and paste it in your HTML
// 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;
URL: http://derekallard.com/blog/post/mysql-natural-sort-order-by-on-non-numeric-field-type/
Comments
 Subscribe to comments
                    Subscribe to comments
                
                