SQL Convert column to row

后端 未结 4 649
执笔经年
执笔经年 2020-12-12 01:39

My table has the following columns:

A  |  B  |  C  |  D  |  E  |  F  

I want to displays this as follow:

MyColumn  |  MyCol         


        
4条回答
  •  南笙
    南笙 (楼主)
    2020-12-12 02:15

    select A as [Col 1], B as [Col 2] from table
    union all 
    select C,D from table 
    union all 
    select E,F from table
    

提交回复
热议问题