List:General Discussion« Previous MessageNext Message »
From:Jim Faucette Date:November 3 1999 4:44pm
Subject:Re: Ordering-by numerically in a VARCHAR field
View as plain text  
Here are two choices:
To answer your question ... use:
SELECT another_column FROM table_name WHERE column_name+0 > 0;

The better solution is to ALTER your table changing the column to an
int. MySQL will do the conversion as it's altering. Then you can DELETE
all records with a column value of 0.

  jim...

Dan Ray wrote:
> 
> Anybody know how to do that? The manual wasn't terribly enlightening.
> 
> The field in question was the victim of a bad decision when the table was
> created. Although it's a VARCHAR, in fact all it's contents are numeric. I
> wouldn't mind not getting records that have any alpha characters, as those
> would certainly have been created during testing and have no relevance in
> this query I'm working on.
>
Thread
Ordering-by numerically in a VARCHAR fieldDan Ray3 Nov
  • Re: Ordering-by numerically in a VARCHAR fieldsinisa3 Nov
  • Re: Ordering-by numerically in a VARCHAR fieldJim Faucette3 Nov
    • Size and numbersDavid Moreno S.3 Nov
  • Re: Ordering-by numerically in a VARCHAR fieldBill Marrs3 Nov