sort by first matching number then by second matching number in SQL
Suppose, I have a table entries as following.
Btc0504
Btc_0007_Shd_01
Btc_007_Shd_01
Bcd0007_Shd_7
ptc00044
Brg0007_Shd_6
Btc0075_Shd
Bcc43
MR_Tst_etc0565
wtc0004_Shd_4
vtc_Btc0605
so it should bring records as following.
wtc0004_Shd_4
Bcc43
ptc00044
Btc_007_Shd_01
Btc_0007_Shd_01
Brg0007_Shd_6
Bcd0007_Shd_7
Btc0075_Shd
Btc0504
MR_Tst_etc0565
Btc_vtc0605
So basically it sorts by numbers only, words are only separator of numbers.
Here middle strings can be of any numbers.
They are not fixed and this pattern is also not fixed.
so there can be more strings and numbers with row. i.e. a1b2c3d4e5..., u7g2u9w2s8...
So require dynamic solution.
Example table is given below.