php - My sql sorting varchar field with numeric part -


hi have table data_table .i need title table.the title field (type varchar) contain alphanumeric data below

title --------- ab 2007 ab 2017 ba 2018 ba 2017 cd 2017 cd 2016 

my desired output

 title ---------  ba 2018  ab 2017  ba 2017  cd 2017  cd 2016  ab 2007 

i tried cast .but didnt required result

select title, cast(title signed) casted_column data_table order `title` desc 

use right last 4 digits , cast unsigned , sort

select title  tbl order cast(right(title,4) unsigned) desc, title desc 

Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -