sql server 2008 中 将上图中的数据 变为
标准大床房 3
豪华大床房 0
普通大床房 0
大神们 我搞不懂行转列,列转行求帮忙
http://www.360doc.com/content/17/0122/17/38509023_624182710.shtml
用unvipot
SELECT lx,sl FROM
( select 3'标准大床房',0'豪华大床房',0'普通大床房'from 表)T
UNPIVOT
(sl FOR lx IN(标准大床房,豪华大床房,普通大床房)) P order by sl