MySQL 时间

SELECT count(1) from cw_capture_count WHERE date = DATE_SUB(CURDATE(),INTERVAL 1 DAY); //查询当前时间往前推一天

SELECT count(1) from cw_capture_count WHERE date = DATE_SUB(CURDATE(),INTERVAL 0 DAY); //查询当前日期

SELECT count(1) from cw_capture_count WHERE date = DATE_SUB(CURDATE(),INTERVAL -1 DAY); //查询当前时间往后推一天

SELECT count(1) from cw_capture_count WHERE date = DATE_SUB(CURDATE(),INTERVAL -1 MONTH); //查询当前时间往后推一月

SELECT count(1) from cw_capture_count WHERE date = DATE_SUB(CURDATE(),INTERVAL -1 YEAR); //查询当前时间往后推一年

posted @ 2018-12-13 11:32  手中天  阅读(175)  评论(0编辑  收藏  举报