Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2004
    Posts
    1

    Unanswered: Need help with "order by"

    Hello,

    i want to build up an database with results for my soccer-club.

    I want to sort the results by date and then the league (because we have thre teams in three f´different leagues)

    But when i do it with "order by date" then it works not correct:

    Example:

    25.01.2003 Team 1 vs. Team 2 4:2
    23.12.2002 Team 1 vs. Team 4 5:1
    22.01.2003 Team 1 vs Team 16 4:1

    You know what i mean.

    What have i to do that it works correct. Not only the first number of the date?

    Thanks alot for your help.

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    actually, i don't know what you mean

    the sql you want is

    ... order by datefld, league

    if it is sorting by the first number of the date, this suggests your date field is a character string and not a date field...
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Jan 2004
    Location
    Kennesaw, GA
    Posts
    10
    Or, what you could do is change the format of your date to be 2003.12.23 etc, and then even if the column type is a string/char, it will still sort correctly.

Posting Permissions

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