SQL Dateff DB2
SELECT DISTINCT
LEAST(180, DAYS(curdate()) - DAYS(start_date)) as days
FROM table2
where expire_date > curdate()
Quaint Quail
SELECT DISTINCT
LEAST(180, DAYS(curdate()) - DAYS(start_date)) as days
FROM table2
where expire_date > curdate()