sqldatetime

How to select records from last 24 hours using SQL?


I am looking for a where clause that can be used to retrieve records for the last 24 hours?


Solution

  • SELECT * 
    FROM table_name
    WHERE table_name.the_date > DATE_SUB(CURDATE(), INTERVAL 1 DAY)