Subject | Problem with sorting string field like nuber field conteins numbers at the begining and sometimes letters after number. |
---|---|
Author | Piotr Olszewski |
Post date | 2012-10-07T16:46:12Z |
Hello everyone.
I have string field (varchar(20) which contains number, but sometimes has
some letters on the end.
Of course i need to sort records with this field but in the way as that was
number field not string filed.
I try to use
ORDER BY LPAD(My_filed,20,'0')
and it works when field conteins only numbers.
When i try to use with a letter on the end it doesn't work correctly.
f.e
12
13
15
..
..
..
139
13a
140
i need:
12
13
13a
14
15
Any ideas??
Pozdrawiam
Piotr Olszewski
[Non-text portions of this message have been removed]
I have string field (varchar(20) which contains number, but sometimes has
some letters on the end.
Of course i need to sort records with this field but in the way as that was
number field not string filed.
I try to use
ORDER BY LPAD(My_filed,20,'0')
and it works when field conteins only numbers.
When i try to use with a letter on the end it doesn't work correctly.
f.e
12
13
15
..
..
..
139
13a
140
i need:
12
13
13a
14
15
Any ideas??
Pozdrawiam
Piotr Olszewski
[Non-text portions of this message have been removed]