views:

139

answers:

1

Ok, I need something like this:

datediff(second, date_one, date_two) < 1

dates are stored in a column 'datetime' type

UPDATE

I want to find dates which differ in less than several (say, 10) seconds

+4  A: 

Second is the smallest unit in DATETIME fields. If you want to check that the difference is less than 1 second, that means that the two dates must be the same, in which case you can simply use the equivalency operator.

To check the time difference using bigger units you can use TIMEDIFF with TIME_TO_SEC. For example to check if two datetimes are between 10 seconds of each other

ABS(TIME_TO_SEC(TIMEDIFF(datetime1, datetime2))) < 10
reko_t
ok, I stated my goal not correctly, let difference be, say, 10 *seconds*
jonny
edited my answer to answer that
reko_t