SQL 将一行转换为两列(标签值)

SQL convert a row into two columns (label-value)

我查询我的数据库并得到以下行:

**NAME | DESCRIPTION | MOBILE | EMAIL | CENTER |**

George | Nice guy    | 644213568 | geo@gmail.com | NASA |

我想将其转换为:

标签 |值

Name | George

DESCRIPTION | Nice guy

MOBILE | 644213568

EMAIL | geo@gmail.com

CENTER | NASA

提前致谢!!!!!

你想要 apply :

select tt.LABEL, tt.VALUE
from table t cross apply
     ( values ('DESCRIPTION', DESCRIPTION), ('MOBILE', MOBILE), ('EMAIL', EMAIL), ('CENTER', CENTER) 
     ) tt(LABEL, VALUE)
 where t.USER_ID = 23;