MySQL selects all with expected date more than 24 hours


Database structure contains a datetime column in "2014-09-22 21:16:00" format.

I want to SELECT everything where the datetime is older than 24 hours.

Example data:

    2014-10-15 21:00:00
    2014-10-15 22:10:00

SELECT * FROM table WHERE $datetime is older than 24 hours.

Current Datetime is for example 2014-10-16 21:01:00 yet.

Result should be:

    2014-10-15 21:00:00

I want to SELECT with the current datetime.

I've tried following, but it does not work:

    SELECT id, datetime FROM table WHERE customerNumber="1" AND datetime < DATE_SUB(NOW(), INTERVAL 24 HOUR)

Hope, somebody can help me. :/

You may try :

SELECT id, datetime FROM TABLE WHERE customerNumber="1" AND HOUR(TIMEDIFF(NOW(), datetime))>24;