코테/프로그래머스

동명 동물 수 찾기

밍래그로프 2020. 12. 29. 15:28

mysql로 할 때

SELECT name,COUNT(name) AS count FROM animal_ins 
GROUP BY name HAVING 2<=count ORDER BY name

 

oracle로 할 때

1.SELECT name,COUNT(name) AS count FROM animal_ins 

GROUP BY name HAVING 2<=COUNT(name) ORDER BY name

!!oracle은 HAVING절에서는 alias를 쓸 수 없다.