首页 > 其他 > 详细

多列转一行

时间:2014-11-25 12:12:14      阅读:313      评论:0      收藏:0      [点我收藏+]

select [Document No_],STUFF ((select ‘ ,‘+[Item No_]+‘: ‘+Convert(varchar(20),Convert(int,[Qty_ Per Pallet]))+

‘ ‘+[Packing Unit of Measure]+‘ * ‘+Convert(varchar(20),Convert(int,[Packing Qty_ per]))+‘ ‘+[Unit of Measure Code]
from [Line] as tb01
where tb01.[Document No_]=tb02.[Document No_] for xml path(‘‘)),1,2,‘‘) as speclist
from [Line] as tb02
where tb02.[Document No_] in (‘A1‘,‘A2‘,‘A3‘)
group by [Document No_]

多列转一行

原文:http://www.cnblogs.com/z5337/p/4120455.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!