1

我想查询表值

Column1 Column2 Column3   
-----------------------
a         b      c    
d         e      f

结果应该是

Column1 a
Column2 b
Column3 c
Column1 d
Column2 e
Column3 f

基本上是一个键值对。甲骨文有可能吗?

我在这里先向您的帮助表示感谢

4

1 回答 1

1

你可以这样做UNION ALL,像这样:

SELECT 'Column1' as Name, Column1 as Value FROM my_table
UNION ALL
SELECT 'Column2' as Name, Column2 as Value FROM my_table
UNION ALL
SELECT 'Column3' as Name, Column3 as Value FROM my_table

这是关于 sqlfiddle 的演示

于 2013-01-25T17:10:27.707 回答