我在 mysql 中有下表:
A B C D
1 2 3 4
我想把它变成
<title1> <title2>
A 1
B 2
C 3
D 4
我只发现了复杂的东西,有谁知道一个简单的 staright forward 函数可以做到这一点吗?
最佳答案
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
关于sql - 列到 MySql 中行的简单枢轴,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5078916/