www.webdeveloper.com
Results 1 to 3 of 3

Thread: Why is it completely ignoring this (MySQL)

  1. #1
    Join Date
    Jun 2006
    Location
    Under your bed
    Posts
    357

    Question Why is it completely ignoring this (MySQL)

    SELECT * FROM thread_reports ORDER BY report_datetime DESC, resolved DESC

    It's completely ignoring the "resolved" at the end. Even if I change it to this:

    SELECT * FROM thread_reports ORDER BY report_datetime, resolved

    But if I do this:
    SELECT * FROM thread_reports ORDER BY resolved

    Then it makes the "resolved" column a factor in how it orders the results.

    Soooo what the heck is going on? Why does it ignore resolved except when it's by itself?

  2. #2
    Join Date
    Aug 2005
    Location
    The Garden State
    Posts
    5,634
    because order by clauses are written like:

    Code:
    ORDER BY
    (column name [ASC|DESC] )*
    No comma.

  3. #3
    Join Date
    Jan 2007
    Location
    Wisconsin
    Posts
    2,120
    Actually, the initially posted queries should work--sorting by multiple columns does require that the columns be separated by a comma. My initial reaction to the original question is that you're probably misinterpreting what the sort should do. Can you supply some sample output using a small data set and the "broken" query?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles