[programmers] MySQL - Lv.4 년, 월, 성별 별 상품 구매 회원 수 구하기 (group by)
문제 풀이 select b.year, b.month, a.gender, count(distinct(a.user_id)) users from user_info a join (select user_id, year(sales_date) year, month(sales_date) month from online_sale) b on a.user_id = b.user_id where a.gender is not null group by b.year, b.month, a.gender order by b.year, b.month, a.gender