MySql中列到行的简单枢轴

MySql中列到行的简单枢轴,sql,mysql,pivot,Sql,Mysql,Pivot,我在mysql中有下表: A B C D 1 2 3 4 我想把它转换成 <title1> <title2> A 1 B 2 C 3 D 4 A 1 B 2 C3 D 4 我只发现了一些复杂的东西,有人知道一个简单的星光前向函数可以做到这一点吗 select 'A' as title1, a as title2 from table union all select 'B' as title1, b as t

我在mysql中有下表:

A B C D
1 2 3 4
我想把它转换成

<title1> <title2>
A        1
B        2
C        3
D        4

A 1
B 2
C3
D 4
我只发现了一些复杂的东西,有人知道一个简单的星光前向函数可以做到这一点吗

select 'A' as title1, a as title2 from table union all
select 'B' as title1, b as title2 from table union all
select 'C' as title1, c as title2 from table union all
select 'D' as title1, d as title2 from table