[DB-SIG] Multiple Fields in "Order by" Command
Casey Bralla
Casey at nerdworld.org
Wed Nov 24 02:14:27 CET 2004
<sigh> I knew it would be simple, but I didn't think it would be **that**
simple!
Thanks guys! (And the help was in record time too!)
On Tuesday 23 November 2004 8:07 pm, Chris Cogdon wrote:
> On Nov 23, 2004, at 16:56, Casey Bralla wrote:
> > I'm trying to sort my database by multiple fields. I have written a
> > query
> > that says:
> > "select * from TABLE1 order by FIELD1 + FIELD2 + FIELD3"
> >
> > Unfortunately, while I can sort by any single FIELD, I am unable to
> > create the
> > multi-field sort I want to create. I've tried parentheses, using the
> > "&"
> > sign, etc. I figure there's gotta be an easy way to do this... but
> > I'll be
> > darned if I can find it in the docs or on-line.
> >
> > Can somebody please point me in the right direction?
>
> orderbyfields [ 'field1`, 'field2', 'field3' ]
> "select * from table1 order by" + ",".join ( orderbyfields )
--
Casey Bralla
Chief Nerd in Residence
The NerdWorld Organisation
More information about the DB-SIG
mailing list