https://sqlwhisper.wordpress.com/2013/03/24/stuff-and-for-xml-path-for-string-concatenation/
来源:互联网 发布:上海每日房屋成交数据 编辑:程序博客网 时间:2024/06/07 06:56
STUFF AND FOR XML PATH for String Concatenation
We can use XmlPath('')
to concatenate column data into single row. Stuff is used to remove the first ‘,’ after string concatenation.
declare @Test Table(sno int,scity varchar(20))
Insert @Test(sno,scity)
Values
(1,'Chicago'),(1,'Detriot')
,(2,'Memphis'),(2,'Nashville')
,(3,'New York'),(3,'Dallas')
,(4,'Atlanta'),(4,'Houston')select distinct sno ,
STUFF((Select ','+Scity
from @Test T1
where T1.sno=T2.sno
FOR XML PATH('')),1,1,'') from @Test T2
阅读全文
0 0
- https://sqlwhisper.wordpress.com/2013/03/24/stuff-and-for-xml-path-for-string-concatenation/
- stuff 与 for xml path('')
- SQL之 Stuff和For xml path
- Sql Server STUFF与FOR XML PATH
- for xml path(string)
- stuff(select ',' + fieldname from tablename for xml path('')),1,1,'')
- sql的for xml path 和 stuff 结合使用
- 【sqlserver】字符串拼接实现(for xml path ,stuff)
- FOR XMI PATH,STUFF 实现字段拼接
- SQL 字段charindex,stuff,ltrim, for xml path('') 操作字符串 合并查询结果项值
- 灵活运用 SQL SERVER FOR XML PATH和SQL Stuff用法
- SQL Server 中利用STUFF和FOR XML PATH()实现多行数据的拼接
- sqlserver中 多条数据合并成一条数据 (stuff 与 for xml path 连用)
- sqlserver 用 STUFF 和 for xml path 把查询结果连接成字符串
- SqlServer stuff + for xml path 用法(以权限角色管理为例讲解)
- FOR XML PATH
- for xml path('')
- FOR XML PATH
- Android线程池详解
- Bootstrap Table总结
- React Router页面传递参数-1
- Leetcode 309. Best Time to Buy and Sell Stock with Cooldown
- 特征直方图的特征参数
- https://sqlwhisper.wordpress.com/2013/03/24/stuff-and-for-xml-path-for-string-concatenation/
- 反射再学习
- JSP&Servlet中request.getParameter() 和request.getAttribute() 区别
- 静态成员函数
- 深度学习笔记空间金字塔池化阅读笔记Spatial Pyramid Pooling in Deep Convolutional Networks for Visual Recognition
- LeetCode 383:Ransom Note (c++)
- U盘修复工具哪个好?7款U盘低格工具详解
- 我的第一篇博客
- My Blog