문제
내가 작성한 정답
MySQL
select client_id, month(time_id) as month, count(distinct user_id) as users_num
from fact_events
group by client_id, month(time_id)
order by 1, 2;PostgreSQL, Oracle
select client_id, extract(month from time_id) as month, count(distinct user_id) as users_num
from fact_events
group by client_id, extract(month from time_id)
order by 1, 2;select client_id, to_number(to_char(time_id,'mm'),'99') as month, count(distinct user_id) as users_num
from fact_events
group by client_id, to_number(to_char(time_id,'mm'),'99')
order by 1, 2;Share article