SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Guru
    Join Date
    Sep 2004
    Location
    Provo, UT
    Posts
    858
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Order by first column, then second column

    I'm trying to sort the results first by their list name, then their date, but it's not working. Any thoughts?




    SELECT f.fID, f.date, f.tID, f.list, t.summary FROM favorites f, testimonies t where f.uID = '110' and f.tID = t.tID order by f.list, f.date
    Convert your dollars into silver coins. www.convert2silver.com

  2. #2
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,251
    Mentioned
    59 Post(s)
    Tagged
    3 Thread(s)
    i'm sorry, i am not familiar with the "it's not working" error message

    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  3. #3
    From space with love silver trophy
    SpacePhoenix's Avatar
    Join Date
    May 2007
    Location
    Poole, UK
    Posts
    5,016
    Mentioned
    103 Post(s)
    Tagged
    0 Thread(s)
    Try:

    Code SQL:
    SELECT
          f.fID
        , f.DATE
        , f.tID
        , f.list
        , t.summary
    FROM
        favourites AS f
    INNER JOIN
        testimonies AS t
    ON
        f.tID = t.tID
    WHERE
        f.uID = 110
    ORDER BY
          f.list
        , f.DATE

    When working with two or more tables, you need to use the proper JOIN syntax for the approprite JOIN that you need.
    Community Team Advisor
    Forum Guidelines: Posting FAQ Signatures FAQ Self Promotion FAQ
    Help the Mods: What's Fluff? Report Fluff/Spam to a Moderator

  4. #4
    SitePoint Wizard donboe's Avatar
    Join Date
    Jun 2010
    Location
    Netherlands
    Posts
    2,099
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It alse depends on which part of the date you would like to order (day, month or year?)
    “Good artists copy, great artists steal” (Pablo Picasso - 1934)

  5. #5
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,251
    Mentioned
    59 Post(s)
    Tagged
    3 Thread(s)
    Quote Originally Posted by SpacePhoenix View Post
    When working with two or more tables, you need to use the proper JOIN syntax for the approprite JOIN that you need.
    yeah, but this has nothing to do with the stated problem, achieving a specific order
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"


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
  •