Transposing Rows in to colums in SQL Server 2005

前端 未结 2 2014
天涯浪人
天涯浪人 2020-12-22 06:28

I have an sql query \"Select * from tablename\" whose output is

col1   col2       
  A     1 
  B     2 
  C     3

I want to modify the ab

2条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-22 06:59

    You want to use PIVOT or COALESCE in sql.Here is a nice examples how to converting rows to columns. Five methods converting rows to columns

    .

提交回复
热议问题