我比较2个时间的大小 
      select  to_days('2010-10-10') - to_days('2009-10-10');   这种方法外,请问还有别的方法吗?

解决方案 »

  1.   

    直接比就行了。mysql> select '2010-10-10'>'2009-10-10';
    +---------------------------+
    | '2010-10-10'>'2009-10-10' |
    +---------------------------+
    |                         1 |
    +---------------------------+
    1 row in set (0.00 sec)mysql> select '2010-10-10'<'2009-10-10';
    +---------------------------+
    | '2010-10-10'<'2009-10-10' |
    +---------------------------+
    |                         0 |
    +---------------------------+
    1 row in set (0.00 sec)mysql>
      

  2.   

    mysql> select '2010-10-10'>'2009-10-10';
    +---------------------------+
    | '2010-10-10'>'2009-10-10' |
    +---------------------------+
    |                         1 |
    +---------------------------+
    1 row in set (0.00 sec)