$1.36

MySQL select records created before a certain time ago

Ask a question+
1

I want to select all records which are created 4 hours ago.

Here what I’ve tried

select id,execution_date from mail_queues where date_format('execution_date','%H') < date_format(date_sub( now(),interval -4 hour ),'%H');

Above Query return empty result

My Table structure

id name execution_date
1 sample mail 2019-11-15 10:33:54
2 status mail 2019-11-15 10:33:54
add comment

0 Answer

Your Answer