CASE
WHEN TIMESTAMPDIFF(MINUTE,o.createDate,o.chargingStartDate) != THEN
'APP解锁计费'
ELSE
'系统自动计费'
END TIMESTAMPDIFF(MINUTE,o.createDate,o.chargingStartDate) o.chargingStartDate减去o.createDate相减后得到分钟,如果后者小于前者分钟为负数。 SELECT TIMESTAMPDIFF(MONTH,'2009-10-01','2009-09-01'); interval可是:
SECOND 秒 SECONDS
MINUTE 分钟 MINUTES
HOUR 时间 HOURS
DAY 天 DAYS
MONTH 月 MONTHS
YEAR 年 YEARS select id, createDate,now() ,MINUTE(timediff(now(), createDate)) from t_base_task limit