mardi 4 août 2015

SQL select order by contains num

This is my table:

--------------
    Names
--------------
   "Ben 52"
   "Dan 236"
   "Carter 73"
   "Harry"
   "Peter 53"
   "Connor 27"
   "Morgan"
   "Richard 675"

I want to create a query that puts the columns without numbers at the end of the list. This is basically the idea of what I'm trying to create:

SELECT names FROM table1 ORDER BY ContainsNum(names) DESC

This is the result I should get:

--------------
    Names
--------------
   "Ben 52"
   "Dan 236"
   "Carter 73"
   "Peter 53"
   "Connor 27"
   "Richard 675"
   "Harry"
   "Morgan"

Please comment if I wasn't clear enough. I haven't see anyone ask this question before.

Thank you!



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire