MasterKaos
Programmer
How can i sort the following VARCHARs in ascending order as if they were integers?
When i ORDER BY product_code i get this:
but what i want is this:
I'm importing a clients database into a web app and unfortunately they've broken one of the golden rules of database design - meaningless identifiers.
So although they are mainly numbers, the product code column is declared as VARCHAR(31), because the codes have a few letters thrown in.
----------------------------------------------------------------------------
The first 90% of the code accounts for the first 90% of the development time. The remaining 10% of the code accounts for the other 90% of the development time.
When i ORDER BY product_code i get this:
Code:
1116
1119
1120
113
118
but what i want is this:
Code:
113
118
1116
1119
1120
I'm importing a clients database into a web app and unfortunately they've broken one of the golden rules of database design - meaningless identifiers.
So although they are mainly numbers, the product code column is declared as VARCHAR(31), because the codes have a few letters thrown in.
----------------------------------------------------------------------------
The first 90% of the code accounts for the first 90% of the development time. The remaining 10% of the code accounts for the other 90% of the development time.