SELECT
seller_id,
count(distinct order_id) orders
FROM
olist_order_items_dataset
GROUP BY
seller_id
HAVING
count(DISTINCT order_id) >= 100
SELECT
seller_id,
sum(distinct order_id) orders
FROM
olist_order_items_dataset
GROUP BY
seller_id
HAVING
sum(DISTINCT order_id) >= 100
판매자가 판매한 주문 건수를 sum(distinct order_id)
으로 조회했다.
하지만 order_id는
이런 형태이고, 중복 없는 order_id의 개수를 '세어야' 하기 때문에 count(distinct order_id)
으로 조회해야 한다.