Order clause based on value

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is it possible to order records in a database based on the value of a field
element? Say for example that I would like to display a "standings" table for
30 teams in a hockey league. If the season is 1999-2000 or earlier I would
like the records to be sorted by a field called "tableold". If season is
2000-2001 or later I would like the records to be sorted by a fild named
"tablemodern".

Appreciate any help given.

Thanks
 
Dragan said:
Is it possible to order records in a database based on the value of a field
element? Say for example that I would like to display a "standings" table for
30 teams in a hockey league. If the season is 1999-2000 or earlier I would
like the records to be sorted by a field called "tableold". If season is
2000-2001 or later I would like the records to be sorted by a fild named
"tablemodern".


Yes, the ORDER BY clause can be a calculated expression.

E.g. ORDER BY IIf(season < "2000-2001", tableold,
tablemodern)

I have no idea how you're going to use that ordering, but I
suspect there's more to it than just that.
 
Thank you very much it works like a charm.Tableold and tablemodern were
mistypes on my part. The first one is actually a tally of the standings in a
leqgue table prior to the season 1997-1998 where a win in a hockeygame was
awarded 2 points. Since that season a win is awarded 3 points. This of course
made the archived tallies totally wrong but thanks to your help everything is
perfect.

Thanks again.

"Dragan" skrev:
 
Back
Top