SQL Server 2005 可以实现 --------------------------使用 PIVOT 和 UNPIVOT http://msdn.microsoft.com/zh-cn/library/ms177410.aspx
应该可以搞定的,除非你要显示的列是固定的,我做过的select (select A.a from table1 where A.id=h.id)as a1 ,(select A.a from table1 A.id=h.id)as a2 from table1 as h 大概就是类似这样的句子,你试试吧
sql语句集锦,收藏吧
--------------------------使用 PIVOT 和 UNPIVOT
http://msdn.microsoft.com/zh-cn/library/ms177410.aspx
大概就是类似这样的句子,你试试吧