我在mysql中有以下表格:
A B C D
1 2 3 4
我想把它变成
<title1> <title2>
A 1
B 2
C 3
D 4
我只发现了复杂的东西,有没有人知道一个简单的直接前进功能呢?
答案 0 :(得分:2)
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