[데이터베이스 통계쿼리] 13. pivot

김건우's avatar
Mar 04, 2025
[데이터베이스 통계쿼리] 13. pivot
행의 값을 열로 변환하는 것
notion image
notion image
select sum(if(day='일', num_day, 0)) '일', sum(if(day='월', num_day, 0)) '월', sum(if(day='화', num_day, 0)) '화', sum(if(day='수', num_day, 0)) '수', sum(if(day='목', num_day, 0)) '목', sum(if(day='금', num_day, 0)) '금', sum(if(day='토', num_day, 0)) '토' from cal group by week;
notion image
Share article

gunwoo