www.webdeveloper.com
Results 1 to 4 of 4

Thread: Order more than one column

  1. #1
    Join Date
    Apr 2003
    Location
    Rosemount, MN
    Posts
    2,287

    Order more than one column

    I am trying to order my results, and I need to order by two colums I have this:

    PHP Code:
    $thread1 "SELECT * FROM threads WHERE idnum='$threadnum' ORDER BY date AND ORDER BY time DESC"
    It doesn't work

    Is there a better way to get this to order?

    I would like it to be ordered by date, then by time.

  2. #2
    Join Date
    Aug 2005
    Location
    The Garden State
    Posts
    5,634
    you mean this...
    PHP Code:
     $thread1 "SELECT * FROM threads WHERE idnum='$threadnum' ORDER BY date, time DESC"
    I wonder though why date and time are two different fields?

  3. #3
    Join Date
    Apr 2003
    Location
    Rosemount, MN
    Posts
    2,287
    So when I compair, There are times I need just the time, and times I need just the date.

  4. #4
    Join Date
    Aug 2005
    Location
    The Garden State
    Posts
    5,634
    there are time extraction functions that you can use to compare.

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