...

View Full Version : Order By 2 Things?



dniwebdesign
10-12-2004, 08:36 AM
I have data (hockey league stats) say at http://www.nsjhl.com/hockeystats/stats.php?type=league

I have it sorting by the points however if the team is tied in points I would like it to order them by the games played, the less games the higher you are above the team tied with you...

Is there anyway I can ORDER BY two different coloums?

Nightfire
10-12-2004, 10:04 AM
ORDER BY id AND date

I think that's right

dniwebdesign
10-15-2004, 05:35 AM
I'll give that a shot...

hemebond
10-15-2004, 07:34 AM
SELECT field1,field2 FROM table ORDER BY field1,field2This question should be under MySQL (http://codingforums.com/forumdisplay.php?f=7).

dniwebdesign
10-15-2004, 07:48 AM
It deals with the PHP coding and output of how I want it to turn out. ;)

dniwebdesign
10-15-2004, 07:58 AM
Okay the


points,gp
seems to do what I want except I can't get it to sort it by the points descending.... I am using the code DESC but it doesn't work. I have the one with 0 points at the top. It sorts the gp right for the tied teams.

newmand2
10-15-2004, 11:02 AM
uh... i think its

ORDER BY points DESC,gp ASC

or the other way around, I couldnt figure out which u wanted ascending and which descending

dniwebdesign
10-16-2004, 12:37 AM
Well, I wanted something like this


GP PTS
Saskatoon Westleys 5 5
Big River Timberkings 5 4
Saskatoon Quakers 5 4
Saskatoon Chiefs 4 3
Tri-Town Thunder 5 3
Saskatoon Royals 3 2



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum