我想查询表值
Column1 Column2 Coulum3
a b c
d e f
结果应为
Column1 a
Column2 b
Column3 c
Column1 d
Column2 e
Column3 f
基本上是键值对。是否可以在Oracle中使用?
感谢您的帮助
答案 0 :(得分: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