MySQL DATEDIFF函數計算時間間隔
計算table表中next_visit_dt與當前時間相差一天,+1爲當前日期後一天,-1爲前一天
select * from table where datediff(next_visit_dt,now()) = 1
DATE_ADD查詢今年到明年數據
select count(*) from table t where t.create_time between date_format(now(),'%Y-01-01 00:00:00') and date_format(date_add(now(),interval 1 year), '%Y-01-01 00:00:00')