[solvesql] 우리 플랫폼에 정착한 판매자 1

yenpkr·2025년 3월 17일
0

sql

목록 보기
61/91

문제

제출

SELECT
  seller_id,
  count(distinct order_id) orders
FROM
  olist_order_items_dataset
GROUP BY
  seller_id
HAVING
  count(DISTINCT order_id) >= 100

🚨 error

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) 으로 조회해야 한다.

0개의 댓글