I am trying to use ORDER BY to order column data that I am working with. My column data looks something like this.
VP717X VP7865 17C831 AP4R2Q
I need to sort this data in ascending order. The only problem is that Alpha characters need to come before numeric characters. So yea...completely bizzaro world. Is there a way I can do this and still use a SELECT statement with an ORDER BY clause.
Thanks in advance for your help,
asked Jan 05, 2010 at 11:16 AM in Default
As TG said, but I tend to prefer a pseudo column to set the primary ordering (Alpha / Numeric in this example) and then sort by the column as a secondary, so:
ORDER BY CASE WHEN MyCol LIKE '[0-9]%' THEN 2 ELSE 1 END, MyCol
answered Jan 05, 2010 at 01:36 PM
Try this ORDER BY clause:
answered Jan 05, 2010 at 12:03 PM