[Programmers] SQL - 재구매가 일어난 상품과 회원 리스트 구하기

DMIS·2024년 2월 11일
0

SQL

목록 보기
48/48
post-thumbnail

문제

풀이

select 
    t1.user_id,
    t1.product_id
from 
(
    select
        user_id,
        product_id,
        count(distinct online_sale_id) as cnt
    from online_sale
    group by 1, 2
    having count(distinct online_sale_id) > 1
) t1
order by 1, 2 desc
profile
Data + Math

0개의 댓글