列转行?

select top 10 orderid,
stuff((select ','+product_no from orderdetail where o.orderid=orderid
group by orderid,product_no for xml path('')),1,1,'')
from orderdetail o group by orderid

posted on 2013-03-20 14:28  习惯简单  阅读(95)  评论(0)    收藏  举报

导航