SELECT
TO_DAYS(DATE_FORMAT(t.termination_time,'%Y-%m-%d'))-TO_DAYS(CURDATE()) as time,
t.*
FROM
ren_contract_management t
where
CURDATE() BETWEEN DATE_SUB( t.termination_time, INTERVAL 3 MONTH )
AND t.termination_time
AND t.termination_time >= CURDATE()