Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我的结果如下:
level_1_node level_2_node level_3_node level_4_node Node 1 Node2 Node 3 Node 4
我想将其转换为:
Node Node 1 Node 2 Node 3 Node 4
怎么做?
使用unpivot表运算符:
unpivot
select value from tablename unpivot ( value for node in (level_1_node, level_2_node, level_3_node, level_4_node) );
你可以使用联合
select "level_1_node" as Node from Table1 union select "level_2_node" as Node from Table1 union select "level_3_node" as Node from Table1 union select "level_4_node" as Node from Table1
SQL小提琴