SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Nov 2011
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    INTERVAL 1 DAY - reverse to new > oldest

    I have a page showing incidents that occur when..... ok, just incidents

    On that page on the top is the most recent incidents

    and under that there is a list of incidents that happened last 24 hours

    I have the script and it works except it shows the list with the oldest on top and the second most recent
    at the bottom

    How can I reverse so the second most resent is on top and oldest at the bottom

    This is my code
    HTML Code:
    SELECT * FROM `incidents` WHERE time >= SYSDATE() - INTERVAL 1 DAY

  2. #2
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,322
    Mentioned
    63 Post(s)
    Tagged
    3 Thread(s)
    add an ORDER BY clause to your SELECT statement

    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
  •