Thread: Sort Problem
View Single Post

   
  #1 (permalink)  
Old 02-27-2008, 09:17 PM
Albert Padley
 
Posts: n/a
Default Sort Problem

I have the following query that has worked fine for displaying
standings for a soccer league.

SELECT * FROM standings WHERE division = 'BU10' AND pool = '1' ORDER
BY tpts DESC, spts DESC, w DESC, ga ASC, team_number ASC

As I said, works fine. Now, however, the league wants a slightly
different sort order. They only want to sort on the spts column if
the difference between 2 teams is greater than 9 in the spts column.
All other sort criteria remain the same. So, the ORDER BY would be
tpts DESC, spts DESC (but only if the difference is > 9), w DESC, ga
ASC, team_number ASC.

If it is possible to form such a query, I need help in what is would
look like.

Thanks.

Al Padley
Reply With Quote