I have mysql table with has field product_name which has data something like
SKL-05
TIP-01
TIP-02 L/R
TIP-12 UV
TIP-120 L/R
TIP-121 L/R
TIP-13 L/R
I want to sort that result like as follow
SKL-05
TIP-01
TIP-02 L/R
TIP-12 UV
TIP-13 L/R
TIP-120 L/R
TIP-121 L/R
Means numberwise in the string 01, 02, 03 etc Please help me guys...
Thanks in Advance !!
substring()function to strip off the first characters.ORDER BY CAST(SUBSTRING_INDEX(SUBSTRING(product_name,5),' ',1) AS INT)might work.