I have a table (books) with 2 columns (book_id, book).
The table looks like:
[HTML]19 Psalms
20 Proverbs
60 1 Peter
61 2 Peter[/HTML]
I want to sort this by text first, then number if a book has a number. So the sorted data would look like:
[HTML]60 1 Peter
61 2 Peter
20 Proverbs
19 Psalms[/HTML]
My query is
This works, but isn't there a better way?
The table looks like:
[HTML]19 Psalms
20 Proverbs
60 1 Peter
61 2 Peter[/HTML]
I want to sort this by text first, then number if a book has a number. So the sorted data would look like:
[HTML]60 1 Peter
61 2 Peter
20 Proverbs
19 Psalms[/HTML]
My query is
Code:
SELECT book FROM books ORDER BY trim(replace(replace(replace(book,'3',''),'2',''),'1','')), book
Comment