Queries and SolutionsCategory: MySQLRecords with date in the last 24 hours
bestonetechnologies Staff asked 6 years ago

How to select records with date in the last 24 hours?

2 Answers
akul answered 6 years ago

SELECT * FROM posts WHERE dateCreated > SUBDATE(CURDATE(), INTERVAL 24 HOUR);

Princy Malothra answered 6 years ago

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

Your Answer

11 + 1 =