ㄴ 매 월 시행
ㄴ 판매량 데이터 분석 리포트 작성
select year(cast(bu.dt as date)) as year,
month(cast(bu.dt as date)) as month,
bu.gcatename,
bu.bcatename,
-- bu.mcatename,
bu.shopid,
sum(bu.purc_price) as purc_price
from temp.shophow_buy_log bu
where dt between '2020-01-01' and '2021-09-31'
-- and bu.bcateid in ('${bcateid}')
group by year(cast(bu.dt as date)),
month(cast(bu.dt as date)),
bu.gcatename,
bu.bcatename,
-- bu.mcatename,
bu.shopid
;
* 참고 cast 함수
cast(필드 as 타입) : 필드의 타입을 강제 변환