반응형
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
- 인프런무료강좌
- NPM
- c#
- 인프런강좌
- 제로초
- 비주얼스튜디오
- 객체리터럴
- slice
- 자바스크립트객체리터럴
- 인프런인강
- Blazor
- 자바스크립트파라미터
- 자바스크립트함수
- 인프런강의
- 객체의비교
- 자바스크립트
- 틱택토구현
- sort
- EntityFramework
- .NET
- 인프런
- 고차함수
- 자바스크립트틱택토
- 이벤트리스너
- HTTP
- 인터넷프로토콜
- 인프런자바스크립트
- 코딩
- 콜백함수
- 자바스크립트recude
Archives
- Today
- Total
샐님은 개발중
PIVOT :Transform data from rows to column 본문
728x90
반응형
if OBJECT_ID('tempdb..##TBL_TEMP') IS NOT NULL
DROP TABLE ##TBL_TEMP
declare @sqlquery as nvarchar(max)
declare @pivotcolums as nvarchar(max)
select @pivotcolums = coalesce(@pivotcolums +',','') + QUOTENAME(Itemcode)
from
(
select distinct itemcode from OrderSales
) as result
SELECT @pivotcolums
set @sqlquery = N'SELECT ' + @pivotcolums +'
into ##TBL_TEMP
FROM [dbo].[OrderSales]
PIVOT (SUM(amount)
FOR ITEMCODE IN ('+ @pivotcolums+')) as Q'
--SELECT @sqlquery
exec sp_executesql @sqlquery
select * from ##TBL_TEMP
728x90
반응형
'LINQ' 카테고리의 다른 글
LINQ 에서 String 문자열을 DateTime 형식과 비교 (0) | 2024.04.02 |
---|---|
2. Join (0) | 2024.02.20 |
1. GROUP BY (단일,여러개) (0) | 2024.02.20 |