You can UNION multiple SELECT statements to transform the results from rows into columns like
Considering PROD_LVL_NM is a unique random value generated against each row...
SELECT KEY, ROW_NUMBER() OVER(ORDER BY KEY) AS PROD_LVL_NM, PROD_CODE FROM
(
SELECT KEY, OA_PRODUCT_1 AS PROD_CODE FROM TBL
UNION ALL
SELECT KEY, OA_PRODUCT_2 AS PROD_CODE FROM TBL
--AND SO ON
) T
↧