ji-0630 / CodingTest

코딩테스트 연습 기록
0 stars 0 forks source link

그룹별 조건에 맞는 식당 목록 출력하기 #239

Closed ji-0630 closed 1 year ago

ji-0630 commented 1 year ago

문제 설명

image image

ji-0630 commented 1 year ago

다른 사람의 풀이

SELECT m.MEMBER_NAME, r.REVIEW_TEXT, date_format(r.REVIEW_DATE, "%Y-%m-%d")
from MEMBER_PROFILE m join REST_REVIEW r
on m.MEMBER_ID = r.MEMBER_ID
where m.MEMBER_ID = (select MEMBER_ID
                    from REST_REVIEW
                    group by MEMBER_ID
                    order by count(*) desc
                    limit 1)
order by r.REVIEW_DATE, r.REVIEW_TEXT
ji-0630 commented 1 year ago

다시 풀기

SELECT m.MEMBER_NAME, r.REVIEW_TEXT, date_format(r.REVIEW_DATE, "%Y-%m-%d") as "REVIEW_DATE"
from MEMBER_PROFILE m left join REST_REVIEW r
on m.MEMBER_ID = r.MEMBER_ID
where m.MEMBER_ID = (select MEMBER_ID
                     from REST_REVIEW
                     group by MEMBER_ID
                     order by count(*) desc
                      limit 1)
order by r.REVIEW_DATE, r.REVIEW_TEXT