Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8
  1. #1
    Regular Coder dniwebdesign's Avatar
    Join Date
    Dec 2003
    Location
    Carrot River, Saskatchewan
    Posts
    842
    Thanks
    15
    Thanked 9 Times in 9 Posts

    Order By 2 Things?

    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?
    Dawson Irvine
    CEO - DNI Web Design
    http://www.dniwebdesign.com

  • #2
    Senior Coder Nightfire's Avatar
    Join Date
    Jun 2002
    Posts
    4,265
    Thanks
    6
    Thanked 48 Times in 48 Posts
    ORDER BY id AND date

    I think that's right

  • #3
    Regular Coder dniwebdesign's Avatar
    Join Date
    Dec 2003
    Location
    Carrot River, Saskatchewan
    Posts
    842
    Thanks
    15
    Thanked 9 Times in 9 Posts
    I'll give that a shot...
    Dawson Irvine
    CEO - DNI Web Design
    http://www.dniwebdesign.com

  • #4
    Senior Coder
    Join Date
    Jul 2004
    Location
    New Zealand
    Posts
    1,315
    Thanks
    0
    Thanked 2 Times in 2 Posts
    Code:
    SELECT field1,field2 FROM table ORDER BY field1,field2
    This question should be under MySQL.

  • #5
    Regular Coder dniwebdesign's Avatar
    Join Date
    Dec 2003
    Location
    Carrot River, Saskatchewan
    Posts
    842
    Thanks
    15
    Thanked 9 Times in 9 Posts
    It deals with the PHP coding and output of how I want it to turn out.
    Dawson Irvine
    CEO - DNI Web Design
    http://www.dniwebdesign.com

  • #6
    Regular Coder dniwebdesign's Avatar
    Join Date
    Dec 2003
    Location
    Carrot River, Saskatchewan
    Posts
    842
    Thanks
    15
    Thanked 9 Times in 9 Posts
    Okay the
    PHP Code:
    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.
    Dawson Irvine
    CEO - DNI Web Design
    http://www.dniwebdesign.com

  • #7
    Regular Coder
    Join Date
    Jan 2004
    Location
    London, UK
    Posts
    234
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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
    Dave

  • #8
    Regular Coder dniwebdesign's Avatar
    Join Date
    Dec 2003
    Location
    Carrot River, Saskatchewan
    Posts
    842
    Thanks
    15
    Thanked 9 Times in 9 Posts
    Well, I wanted something like this
    PHP Code:
                            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 
    Last edited by dniwebdesign; 10-15-2004 at 11:39 PM.
    Dawson Irvine
    CEO - DNI Web Design
    http://www.dniwebdesign.com


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •