摘要: SQL行转列是比较经典的问题:比如有如下数据表,有如下某一款号(表1): 颜色 尺码 库存 红色 S 10 红色 M 80 白色 L 50 白色 S 60要将上面的表转化为如下格式(表2):颜色 S M L红色 10 80 0白色 60 0 50动态sql:create table #tbl_0( color nvarchar(12), nsize nchar(1), store int)insert into #tbl_0select 'red', 'S', '10' union allselect 'red', 'M& 阅读全文
posted @ 2013-07-19 17:15 Master HaKu 阅读(445) 评论(0) 推荐(0)