티스토리 뷰
커뮤니티에 약간 자주 String Concat, String Group By가 올라와서..,
USE AdventureWorks
GO
SELECT c.Name ID, s.Name
INTO #t
FROM Production.ProductCategory c
JOIN Production.ProductSubcategory s ON c.ProductCategoryID=s.ProductCategoryID
SELECT * FROM #t
Bikes Mountain Bikes
Bikes Road Bikes
Bikes Touring Bikes
Components Handlebars
Components Bottom Brackets
Components Brakes
Components Chains
Components Cranksets
Components Derailleurs
Components Forks
Components Headsets
Components Mountain Frames
…..,
SELECT ID, STUFF(
(SELECT ',' + a.Name AS [text()]
from #t a
where a.ID = b.ID
Order by a.Name
for xml PATH('')),1,1,'' ) AS r
from #t b
group by ID
ORDER BY ID
'SQL > T-SQL' 카테고리의 다른 글
기본적이고 유용한 T-SQL (2) - TRY CATCH, ERROR 함수 (0) | 2011.02.18 |
---|---|
SQL Server 시작일 default value (0) | 2011.02.14 |
기본적이고 유용한 T-SQL (1) - SPID KILL (0) | 2011.02.11 |
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- SharePoint 2013
- Power BI Desktop Update
- Windows Azure 업데이트
- Power BI Desktop 업데이트
- Power BI Desktop
- Microsoft Fabric
- Cloud
- SharePoint 2010
- Windows Azure
- Power BI Update
- Windows Phone 7
- Paginated Report
- SharePoint Online
- SQL Azure
- copilot
- sharepoint
- Power BI 업데이트
- 목표
- sql server 2012
- Visual Studio 2010
- Power BI
- SharePoint Object Model
- hongju
- Power BI Copilot
- redJu
- 클라우드
- 정홍주
- 페이지를 매긴 보고서
- 업데이트
- Windows Azure Mobile Services
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
글 보관함