ms sql 将列转换成行
B21ID1,B21ID2,B21ID3,B21ID4为要转换的列,他们都是float,
select B21ID1,B21ID2,B21ID3,B21ID4 from MEDI_OV_BILLING where BILLINGID = 1000638748
下面将他们都转换成ICDCode一列,所有上面的列数据都变成行数据
select B21ID1 as ICDCode from MEDI_OV_BILLING where BILLINGID= 1000638748 union
select B21ID2 as ICDCode from MEDI_OV_BILLING where BILLINGID= 1000638748 union
select B21ID3 as ICDCode from MEDI_OV_BILLING where BILLINGID= 1000638748 union
select B21ID4 as ICDCode from MEDI_OV_BILLING where BILLINGID= 1000638748