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

python - Operations inside variables -

Generic Map Parameter java -

arrays - What causes a java.lang.ArrayIndexOutOfBoundsException and how do I prevent it? -