SELECT a.animal_id , a.name
from animal_ins a, animal_outs b
where a.animal_id = b.animal_id
order by datediff(b.datetime, a.datetime) desc
limit 2
'코드카타' 카테고리의 다른 글
[SQL]프로그래머스 Lv1. 조건에 맞는 도서 리스트 출력하기 (0) | 2023.12.21 |
---|---|
[SQL]프로그래머스 Lv4. 보호소에서 중성화한 동물 (0) | 2023.12.21 |
[SQL]프로그래머스 Lv3. 있었는데요 없었습니다. (0) | 2023.12.21 |
[SQL]프로그래머스 Lv. 2 상품 별 오프라인 매출 구하기 (1) | 2023.12.21 |
[SQL]프로그래머스 Lv3. 카테고리 별 도서 판매량 집계하기 (1) | 2023.12.21 |