• Cody Bonney
  • January 29, 2014
mysql

Select all rows created more than 48 hours ago using MySQL

The MySQL query below will select all rows in a table that were created more than 48 hours prior to the query.

Replace YOUR_TABLE and YOUR_DATETIME_COLUMN with the appropriate values.

SELECT * 
  FROM YOUR_TABLE r
  WHERE r.YOUR_DATETIME_COLUMN < DATE_SUB(NOW(), INTERVAL 48 HOUR)

more MySQL posts

mysql Installing MySQL 5.6 on CentOS 6.3 using YUM
mysql How to clear the ibdata1 file when using MySQL InnoDB storage engine