• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 741
  • Last Modified:

SELECT Records by time span

Is there any way to select records in MySql by a time span.  For example I want to select all records that have been added within the last 15 minutes?  I have a column named DateAndTime which is inserted using the Now() command.

Thanks
0
johnywhite
Asked:
johnywhite
1 Solution
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html

SELECT * FROM tbl_name
WHERE date_col>= DATE_SUB(CURDATE(),INTERVAL 15 MINUTE) ;
0
 
johnywhiteAuthor Commented:
That worked thanks!
0

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now