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