문제
풀이
서브 쿼리를 활용하여 풀었다.
SELECT A.ID, B.FISH_NAME, A.LENGTH
FROM FISH_INFO AS A
JOIN FISH_NAME_INFO AS B
ON A.FISH_TYPE = B.FISH_TYPE
WHERE (A.FISH_TYPE, A.LENGTH) IN (SELECT FISH_TYPE, MAX(LENGTH) AS LENGTH
FROM FISH_INFO
GROUP BY FISH_TYPE)
ORDER BY A.ID;
728x90