sql列跳槽
想将一个查询的结果,从横向的一个记录开始,作为一列显示。 这里查询了130个因子数据。 sql语句看起来很可怕,但只看一两行就ok了
转换结果
sql语句:
selectb.c1as climate _ valuefromclimate _ indexbwheretm=' 195101 ' unionallselectb.c2as climate _ valuefromclimate _ iion exbwheretm=' 195101 ' unionallselectb.C4 as climate _ valuefromclimate _ value onallselectb.C5 as climate _ valu fromclimate 6 as climate _ valuefromclimate union all . selectb.c 125 as climate _ valuefromclimate _ indexbwheretm=' 195101 ' unionalalselsete 95101 ' unionallselectb.c127 as climate _ valuefromclimate _ indexbwheretm=' 195101 ' unionallselectb.c 128 am indexbwhereretm aluefromclimate _ indexbwheretm=' 195101 ' unionallselectb .