View Full Version : Order By 2 Things?
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?
10-12-2004, 10:04 AM
ORDER BY id AND date
I think that's right
10-15-2004, 05:35 AM
I'll give that a shot...
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).
10-15-2004, 07:48 AM
It deals with the PHP coding and output of how I want it to turn out. ;)
10-15-2004, 07:58 AM
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.
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
10-16-2004, 12:37 AM
Well, I wanted something like this
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
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.