[ciapug] MySQL table data - "1" and "01" different values
Lathrop Preston
ciapug@cialug.org
Tue, 06 Apr 2004 10:20:36 -0500
Ryan
I may be mistaken but I am afraid the answer will probably be no.
you might be able to store them as a char and use some mySQL internal
conversion before doing the order by.
however, as far as underlying systems are concerned
01 is _not_ a numeric value and will never be represented as such with
the leading 0 intact.
why do you need to store the leading 0?
If you only need leading 0 for the output, you could store integer
values and then do a str_pad() or similar on at output time.
Also if you do not need decimal values use INT not FLOAT
Lathrop
NOTE: all of the above is my oppinion and may be based on incorrect
knowledge
Ryan O'Rourke wrote:
> Is there some way to enter values such as "1" and "01" into a MySQL
> table to have them appear as different values and still be sorted in
> numerical order?
> CHAR doesn't work because ordering by that field does not result in
> sorting by numerical order, and FLOAT drops the leading zeros.
>
> Thanks.
>
> -- Ryan
>
> _______________________________________________
> ciapug mailing list
> ciapug@cialug.org
> http://cialug.org/mailman/listinfo/ciapug