본문 바로가기
언어

DATEDIFF

by 땅호720 2023. 12. 8.
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일 이상

'언어' 카테고리의 다른 글

UNION ALL  (0) 2023.12.12
GROUP_CONCAT  (0) 2023.12.08
CONCAT_WS  (1) 2023.12.08
바이러스 lv.2  (2) 2023.12.07
징검다리 lv.3  (0) 2023.12.07