알고리즘
[프로그래머스] 그룹별 조건에 맞는 식당 목록 출력하기
pooney
2023. 5. 29. 01:03
해결답)
동률 리뷰수에 대한 정의가 정의가 되어 있지 않아 LIMIT1로 해결함.
SELECT
MM.MEMBER_NAME , R.REVIEW_TEXT, DATE_FORMAT(R.REVIEW_DATE, '%Y-%m-%d')
FROM REST_REVIEW R
INNER JOIN MEMBER_PROFILE MM ON R.MEMBER_ID = MM.MEMBER_ID
INNER JOIN
(
SELECT COUNT(*) AS CNT , MP.MEMBER_ID
from MEMBER_PROFILE MP
INNER JOIN REST_REVIEW RR ON MP.MEMBER_ID = RR.MEMBER_ID
GROUP BY MEMBER_ID
ORDER BY CNT DESC
LIMIT 1) A ON R.MEMBER_ID = A.MEMBER_ID
ORDER BY R.REVIEW_DATE ASC , REVIEW_TEXT ASC
https://school.programmers.co.kr/learn/courses/30/lessons/131124