Subject | Re: [ib-support] Re: ORDER BY as number when not |
---|---|
Author | Martijn Tonies |
Post date | 2003-06-01T14:44:01Z |
Hi,
1
11
20
A
AA
BA
??
What kind of order is this? This is a very custom order...
With regards,
Martijn Tonies
Database Workbench - the developer tool for InterBase & Firebird
Upscene Productions
http://www.upscene.com
> >> [ order by cast suggestion: ]Actually - WHO decides that this would be the right order:
> >>
> >>> Yes, tried that. no luck
> >>
> >> OK, too bad. This one works however:
> >>
> >> select cast ( my_char_column as <int or float type here> )
> >> , ...
> >> , ...
> >> from mytable
> >> order by 1
> >>
> >> Or define computed columns for the casts and order on those columns
> >> when you need to. If you need to do that often, add real numerical
> >> columns and populate them in after insert/update triggers.
> >
> > Unfortunately this will work only if values in selected strings will
> > contain only digits. More general solution I think will be store
> > such a columns with leading spaces or add them on select using UDF.
1
11
20
A
AA
BA
??
What kind of order is this? This is a very custom order...
With regards,
Martijn Tonies
Database Workbench - the developer tool for InterBase & Firebird
Upscene Productions
http://www.upscene.com