반응형
250x250
Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
Tags
- 자바스크립트파라미터
- slice
- 객체의비교
- 이벤트리스너
- sort
- 틱택토구현
- 객체리터럴
- 인프런
- EntityFramework
- 제로초
- 자바스크립트함수
- 고차함수
- .NET
- 자바스크립트
- 인프런무료강좌
- 인프런강좌
- 자바스크립트객체리터럴
- 자바스크립트recude
- 인프런자바스크립트
- 콜백함수
- 인터넷프로토콜
- c#
- 자바스크립트틱택토
- Blazor
- 인프런강의
- 비주얼스튜디오
- 인프런인강
- NPM
- 코딩
- HTTP
Archives
- Today
- Total
샐님은 개발중
mssql) Pivot 본문
728x90
반응형
-- convert tows into columns
select [1],[2],[3],[4],[5],[6],[7],[8],[9],[10],[11],[12],customer
from
(select year(orderdate) as [year], month(orderdate) as [month], isnull(customerid,0) as customer ,sum(subtotal)as sales
from sales
where year(orderdate) = '2020'
group by grouping sets ((year(orderdate)), (year(orderdate),month(orderdate)), (year(orderdate),month(orderdate),customerid))
) as Source_table
pivot
(Max(sales) for [month] in([1],[2],[3],[4],[5],[6],[7],[8],[9],[10],[11],[12])
)as Pivot_table
order by customer desc
#pivot쿼리 #개발자 #개발자공부 #웹프로그래머 #쿼리 #mssql
728x90
반응형
'mssql' 카테고리의 다른 글
그룹별 순위 구하기 (0) | 2024.03.13 |
---|---|
cursor (0) | 2023.06.25 |
mssql) 년 _월_분기별 합계 쿼리 (0) | 2023.05.21 |