timediff
あとの時間を第一引数、さきの時間を第二引数
mysql> SELECT TIMEDIFF('2008-12-31 01:01:01.000000', '2008-12-31 01:01:00.000000'); +----------------------------------------------------------------------+ | TIMEDIFF('2008-12-31 01:01:01.000000', '2008-12-31 01:01:00.000000') | +----------------------------------------------------------------------+ | 0:00:01 | +----------------------------------------------------------------------+ 1 row in set mysql> SELECT TIMEDIFF('2008-12-31 01:01:02.000000', '2008-12-31 01:00:00.000000') > '00:00:01'; +-----------------------------------------------------------------------------------+ | TIMEDIFF('2008-12-31 01:01:02.000000', '2008-12-31 01:00:00.000000') > '00:00:01' | +-----------------------------------------------------------------------------------+ | 1 | +-----------------------------------------------------------------------------------+ 1 row in set mysql> SELECT TIMEDIFF('2008-12-31 01:01:02.000000', '2008-12-31 01:00:00.000000') < '00:00:01'; +-----------------------------------------------------------------------------------+ | TIMEDIFF('2008-12-31 01:01:02.000000', '2008-12-31 01:00:00.000000') < '00:00:01' | +-----------------------------------------------------------------------------------+ | 0 | +-----------------------------------------------------------------------------------+ 1 row in set