언어
DATEDIFF
땅호720
2023. 12. 8. 15:32
SELECT HISTORY_ID, CAR_ID,
date_format(START_DATE, '%Y-%m-%d') START_DATE,
date_format(END_DATE,'%Y-%m-%d') END_DATE,
case when datediff(END_DATE, START_DATE)+1 >= 30 then '장기 대여'
else '단기 대여'
end RENT_TYPE
from CAR_RENTAL_COMPANY_RENTAL_HISTORY
where month(start_date)=9
order by HISTORY_ID desc
대여 기간 30일 이상