SELECT TIMESTAMPDIFF(MINUTE,'2015-03-27 9:41:27',t.expiration_date), t.expiration_date FROM online_test t WHERE 0<TIMESTAMPDIFF(MINUTE,'2015-03-27 9:41:27',t.expiration_date) <1440
SELECT TIMESTAMPDIFF(MINUTE,'2015-03-27 9:41:27',t.expiration_date), t.expiration_date FROM online_test t WHERE 0<TIMESTAMPDIFF(MINUTE,'2015-03-27 9:41:27',t.expiration_date) AND TIMESTAMPDIFF(MINUTE,'2015-03-27 9:41:27',t.expiration_date)<1440
复制代码
最后的sql:
SELECT TIMESTAMPDIFF(MINUTE,'2015-03-27 9:41:27',t.expiration_date), t.expiration_date FROM online_test t WHERE TIMESTAMPDIFF(MINUTE,'2015-03-27 9:41:27',t.expiration_date) BETWEEN 0 AND 1440