[프로그래머스] 오랜 기간 보호한 동물(2) SELECT T2.ANIMAL_ID, T2.NAME FROM ANIMAL_INS T1 JOIN ANIMAL_OUTS T2 ON T1.ANIMAL_ID = T2.ANIMAL_ID ORDER BY DATEDIFF(T2.DATETIME+1, T1.DATETIME) DESC LIMIT 2 SQL 2023.07.21