Jump to content

How to select the last 24 hours from a table with DATATIME column


ludah

Recommended Posts

  1. SELECT .... FROM tablename WHERE datetimefield > NOW() - INTERVAL 24 HOUR

SELECT .... FROM tablename WHERE datetimefield > NOW() - INTERVAL 7 DAY

SELECT .... FROM tablename WHERE datetimefield > NOW() - INTERVAL 1 MONTH

SELECT .... FROM tablename WHERE datetimefield > NOW() - INTERVAL 12 HOUR

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.