Reputation: 779
I have a MySQL table with column time which remembers the time of the row.
So my question is how to get rows where time is older than 30 minutes ?
I have red some threads but I get errors. I have tried these, but none of them works...
SELECT * from temp WHERE to_timestamp(insert_date) < NOW() - INTERVAL '30 minutes'
SELECT * FROM temp WHERE insert_date < NOW() - INTERVAL '30 minutes';
Upvotes: 1
Views: 7461
Reputation: 818
SELECT * FROM temp WHERE `timestamp` < (NOW() - INTERVAL 30 MINUTE);
You could take it from just replacing Delete with Select :)
MySQL Delete Records Older Than X Minutes?
MySQL: Delete all rows older than 10 minutes
Upvotes: 9
Reputation: 69524
SELECT * FROM temp
WHERE insert_date < date_sub(now(), interval 30 minute)
Upvotes: 3