Want to sort CHAR field NUMERICALLY in ACE report
Posted in 1994
Topics: General Discussion
I posted this before, but thought I'd make the subject clearer. I'm
selecting a character field in an ACE report but I want to use order by
to sort it numerically. I think there is or should be a way to cast the
char field to type int, but I don't know what it is.
Here's the original post:
thanks,
Eric (eric@saperstein.com)
Eric Thompson <thompson@netcom.com> wrote:
>I have a situation in which I'd like to select a character field
>from a table and sort it as though it were an integer. I know in advance
>that all rows returned will have numeric values, even though the field
>must remain a char field.
>
>I thought something like this should work, but it doesn't:
>
> select int(char_field)
> from table
> order by 1
>
>One inelegant method of solving this that I think might work is:
>
> select char_field
> from table
> order by char_field[1], char_field[2], ..., char_field[8]>
>But that stops working after the eighth digit.
>
>Any help is appreciated. E-mail preferred.
>
>thanks,
>
>Eric Thompson eric@saperstein.com (NeXTmail ok)
>Saperstein, Mayeda & Goldstein thompson@netcom.com