Desired output with given table data
问题 Hi I have a table test its structure is given below: **Testing** PK C1 c2 --------------- 1 v11 v12 2 v21 v23 3 v31 v32 Now I need to query this table (testing) such that I get the below output. Pk Key value --------------- 1 c1 v11 1 c1 v12 2 c2 v21 2 c2 v22 3 c3 v31 3 c3 v32 Can this been possible with sql query in Oracle 11g ,Is it possible with PIVOT feature in 11g? 回答1: No, it can't be done with PIVOT , but it can be done with UN PIVOT: SELECT Pk, "Key", value FROM Testing UNPIVOT (