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