SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Evangelist BJ Duncan's Avatar
    Join Date
    Jun 2007
    Location
    North Richmond
    Posts
    495
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Quich Question on ORDER BY

    I am aware that you can 'ORDER BY' 2 different values
    E.G. ORDER BY name, surname

    But, can you 'ORDER BY' 2 different values and have them ordering in different directions

    E.G ORDER BY group_id ASC, total DESC?

    Does this work? If not, how can I make it work?

    Many thanks in advance
    Regards,
    BJ Duncan

  2. #2
    SitePoint Guru Ruben K.'s Avatar
    Join Date
    Jun 2005
    Location
    Alkmaar, The Netherlands
    Posts
    693
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What do you expect it to do?

  3. #3
    SitePoint Evangelist BJ Duncan's Avatar
    Join Date
    Jun 2007
    Location
    North Richmond
    Posts
    495
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    My apologies Ruben, you can disregard my question as I have finally successfully worked it out. I was doing a query that wasn't working. I thought it may have something to do with the way I was ordering it, but it wasn't, I had some other error within my query, but it is all sorted now.

    Thanks anyway
    Regards,
    BJ Duncan

  4. #4
    SitePoint Zealot
    Join Date
    Jan 2007
    Posts
    103
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    umm, what are you tryin to do?

  5. #5
    SitePoint Evangelist BJ Duncan's Avatar
    Join Date
    Jun 2007
    Location
    North Richmond
    Posts
    495
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I was joining 2 tables and I wanted results to show in order from the group that a user was in first with the group number going from 1 -> 3, then from that group order the group by their total points, from highest scorer to least scorer.

    Thanks anyway
    Regards,
    BJ Duncan

  6. #6
    SitePoint Wizard
    Join Date
    Jul 2003
    Location
    Kent
    Posts
    1,921
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by BJ Duncan View Post
    I am aware that you can 'ORDER BY' 2 different values
    E.G. ORDER BY name, surname

    But, can you 'ORDER BY' 2 different values and have them ordering in different directions

    E.G ORDER BY group_id ASC, total DESC?

    Does this work? If not, how can I make it work?

    Many thanks in advance
    YES


Bookmarks

Posting Permissions

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