-- 정답
SELECT A.REST_ID, B.REST_NAME, B.FOOD_TYPE, B.FAVORITES, B.ADDRESS, ROUND(AVG(A.REVIEW_SCORE),2) AS SCORE
FROM REST_REVIEW A
JOIN REST_INFO B ON A.REST_ID = B.REST_ID
GROUP BY A.REST_ID
HAVING B.ADDRESS LIKE '서울%'
ORDER BY SCORE DESC, B.FAVORITES DESC
안녕하세요! 질문 좀 드려도 될까요?ㅜㅜ 왜 이번 문제에서는 서브쿼리를 사용할 필요가 없는지 궁금합니다ㅜㅜ
SELECT A.REST_ID, A.REST_NAME, A.FOOD_TYPE, A.FAVORITES, A.ADDRESS, B.REVIEW_SCORE AS SCORE
FROM REST_INFO AS A
INNER JOIN REST_REVIEW AS B
ON A.REST_ID = B.REST_ID
WHERE B.REVIEW_SCORE IN (SELECT ROUND(AVG(B.REVIEW_SCORE),2)
FROM REST_REVIEW
GROUP BY REST_ID) AND A.ADDRESS LIKE '서울%'
GROUP BY REST_ID
ORDER BY SCORE DESC, A.FAVORITES DESC
저는 서브쿼리를 사용해서 풀었는데 뭐가 잘못된 건지 모르겠어요ㅜㅜ