From: hsv Date: August 7 2012 6:58pm Subject: Re: query help List-Archive: http://lists.mysql.com/mysql/227960 Message-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" >>>> 2012/07/31 15:02 -0700, Haluk Karamete >>>> So, in a case like this shop.orders.32442 shop.orders.82000 shop.orders.34442 It would be the record whose source_recid is shop.orders.82000. Why? Cause 82000 happens to be the largest integer. <<<<<<<< Now, if they are always 5-digit-long integers, try ending with ORDER BY SUBSTRING_INDEX(source_recid, '.', -1)