문제
SQLite
내가 작성한 정답
→ distinct!!로 잘 걸러내야한다
select order_date,
count(distinct case when category = 'Furniture' then order_id end) furniture,
round((count(distinct case when category = 'Furniture' then order_id end)*100.00/count(distinct order_id)*1.0),2) furniture_pct
from records
group by order_date
having count(distinct order_id) >= 10
and (count(distinct case when category = 'Furniture' then order_id end)*100.00/count(distinct order_id)*1.0) >= 40
order by 3 desc, 1;Share article