leonheart 发表于 2016-11-15 08:21:55

DB2 行转列

WITH t1 ( ISN, A1, B1, C1, A2, B2, C2) as
( SELECT ISN, substr(MEMBER_COVERAGE,1,8) A1,substr(MEMBER_COVERAGE,9,5) B1, substr(MEMBER_COVERAGE,14,5) C1, substr(MEMBER_COVERAGE,21,8) A2,substr(MEMBER_COVERAGE,29,6) B2, substr(MEMBER_COVERAGE,35,6) C2 FROM ARGDO3.O58 )
SELECT t.ISN, Q.A, Q.B, Q.C
FROM t1 AS t, TABLE(VALUES
                  (t.A1, t.B1, t.C1),
                  (t.A2, t.B2, t.C2)) AS Q(A, B, C)
页: [1]
查看完整版本: DB2 行转列