【问题标题】:time different betwen two columns in mysql higher than xx daysmysql中两列的时间差大于xx天
【发布时间】:2012-01-06 21:24:07
【问题描述】:

请帮帮我:

我在 mysql 表中有两列 - date1 (datetime) 和 date2 (datetime)

我需要找到这两天之间的差异大于 14 天的行。

我试过:select * from table where timediff(date1 - date2) as days > 14 它不起作用

谢谢你

【问题讨论】:

    标签: mysql datetime


    【解决方案1】:
    SELECT *
    FROM table
    WHERE ABS(DATEDIFF(date1,date2)) > 14;
    

    【讨论】:

      猜你喜欢
      • 2011-02-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-07-08
      • 2011-09-30
      • 1970-01-01
      • 2014-07-16
      • 1970-01-01
      相关资源
      最近更新 更多