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