[ic] sql order by

Xavier GILLET interchange-users@icdevgroup.org
Sat May 24 11:49:00 2003


Thanks a lot Scott.


----- Original Message -----
From: "Scott B. Gale" <scott@doheny.beach.net>
To: <interchange-users@icdevgroup.org>
Sent: Saturday, May 24, 2003 5:38 PM
Subject: Re: [ic] sql order by


> On Sat, 24 May 2003, Stefan Hornburg wrote:
>
> > On Sat, 24 May 2003 01:47:49 +0200
> > "Xavier GILLET" <xavier.gillet.perso@wanadoo.fr> wrote:
> >
> > > Hello,
> > >
> > >
> > > I try to order results from an sql query.
> > > This is my query :
> > >
> > > [query sql="select capacite_max from [scratch this_page]
> > >  where
> > >  initial_status = 'confirmee'
> > >  and
> > >  actual_status = 'En ligne'
> > >  and
> > >  sens = 'Offre'
> > >  and
> > >  departement = '[scratch dept_chiffre]'
> > >  [scratch query_saison]
> > >  group by capacite_max
> > >  order by capacite_max asc"
> > >         type=list]
> > >
> > > and this is the result : 10 4 5 6
> > >
> > > Order is supposed to be : 4 5 6 10
> > >
> > > How can I force the order to use numeric ?
> >
> > Is capacite_max a numeric field ?
> >
> > Ciao
> > Racke
>
> Assuming you need to force a character field to sort numerically you can
do it in sql like this.
>
> select capacite_max, capacite_max + 0 as numeric_capacite from [scratch
this_page] ...
> order by numeric_capacite ...
>
> This will return the list in the proper order.  You'll get a extra field
returned (numeric_capacite) but just ignore it.
>
> Scott B. Gale
> Dana Point Communications
>
>
>
> _______________________________________________
> interchange-users mailing list
> interchange-users@icdevgroup.org
> http://www.icdevgroup.org/mailman/listinfo/interchange-users
>