문제
https://school.programmers.co.kr/learn/courses/30/lessons/151139
코드
-- 코드를 입력하세요
SELECT MONTH(START_DATE) AS MONTH, CAR_ID, COUNT(MONTH(START_DATE)) AS RECORDS
FROM CAR_RENTAL_COMPANY_RENTAL_HISTORY AS CR
WHERE START_DATE >= "2022-08-01" and START_DATE < "2022-11-01" and CAR_ID IN (SELECT CAR_ID FROM CAR_RENTAL_COMPANY_RENTAL_HISTORY WHERE START_DATE >= "2022-08-01" and START_DATE < "2022-11-01" GROUP BY CAR_ID HAVING COUNT(HISTORY_ID) > 4)
GROUP BY MONTH, CAR_ID
HAVING RECORDS > 0
ORDER BY MONTH(START_DATE), CAR_ID DESC
'프로그래머스' 카테고리의 다른 글
[프로그래머스][SQL] 성분으로 구분한 아이스크림 총 주문량 (0) | 2024.06.08 |
---|---|
[프로스래머스][Python] 순위 - 코팩 (0) | 2024.01.15 |
[프로그래머스][Python] 단어 변환 - 코팩 (0) | 2024.01.11 |
[프로그래머스][Python] 게임 맵 최단거리 - 코팩 (0) | 2024.01.11 |
[프로그래머스][Python] 네트워크 - 코팩 (0) | 2024.01.11 |