Oracle
[프로그래머스] 재구매가 일어난 상품과 회원 리스트 구하기
dearbeany
2023. 11. 22. 19:28
select user_id, product_id
from online_sale
group by user_id, product_id
having count(*) >= 2
order by user_id, product_id desc;
- group by 2개 이상 컬럼 ? select 절에도 똑같이 써줘야 한다
- where vs having 절 ? 필터링 범위가 다름 row 데이터 vs group by 이후 데이터
참고