티스토리 뷰
커뮤니티에 약간 자주 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
- 정홍주
- SQL Azure Data Sync
- Power BI Copilot
- Mobile Services
- Windows Azure Mobile Services
- Microsoft Fabric
- Power BI Desktop 업데이트
- Windows Phone 7
- 페이지를 매긴 보고서
- sql server 2012
- SharePoint 2010
- Windows Azure
- SQL Azure
- Power BI Desktop Update
- copilot
- SharePoint Online
- 클라우드
- 목표
- Windows Azure 업데이트
- redJu
- SharePoint 2013
- Cloud
- Power BI 업데이트
- SharePoint Object Model
- Power BI Desktop
- Visual Studio 2010
- Power BI
- Paginated Report
- hongju
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
글 보관함