转自:http://blog.sina.com.cn/s/blog_5ef755720100cyo3.html pivot函数: create table test(id int,name varchar(20),quarter int,profile int)insert into test values(1,'a',1,1000)insert into test values(1,'a',2,2000)insert into test values(1,'a',3,4000)insert i…