I have a table which has id's(varchar) as
-----------------------------------------
ID |NAME |COLUMN1 |COLUMN2 |
-----------------------------------------
11.10 |abcd |New col | new col |
11.10(a) |abcd |New col | New Col 2|
11.50 |abcd |New COl | New coli |
11.50(a1) |abcd |New col | New Col 2|
11.50(a2) |abcd |New col | New Col 2|
11.300(a) |abcd |New col | New Col 2|
11.200(a) |abcd |New col | New Col 2|
11.100(a) |abcd |New col | New Col 2|
11.40(a) |abcd |New col | New Col 2|
Now, if I am getting the sorted data using:
Select * from table order by length(id) asc,id;
I am getting result like
11.10
11.50
11.10(a)
11.100(a)
11.200(a)
11.300(a)
11.40(a)
11.50(a)
11.50(a1)
But I want the desired output as
11.10
11.10(a)
11.40(a)
11.50
11.50(a)
11.50(a2)
11.200(a)
11.300(a)
What would be the appropriate query for the same? I have tried it using CAST but I am getting the desired output.