I need to perform a Cross Tab like query. I have found out thorugh experience that TRANSFORM and PIVOT do not work in DB2.

Heres what I need. I need each TRAN_CODE to be in its own column with the TRAN_QUANTITY to be the value in that column.

I have this and it runs but it does not show each TRAN_CODE in its own column.

SELECT A.PRIME_BANK,A.ITEM_NUMBER,A.ITEM_DESC,A.CARD_TYPE ,B.ITEM_NUMBER,
A.OLD_ITEM_NUMBER,A.NEW_ITEM_NUMBER, SUM(MAIN_VAULT_END_QTY+
WK_VAULT1_END_QTY)AS INVENTORY,B.TRAN_CODE,SUM(B.TRAN_QUANTITY) AS TQTY
FROM CPS9904.VAULT_MASTER A INNER JOIN CPS9904.VAULT_TRANSACTION B ON
A.ITEM_NUMBER = B.ITEM_NUMBER
WHERE B.TRAN_DATE BETWEEN '2003-03-03' AND '2003-03-07'
AND B.TRAN_CODE IN ('10','11','22','23','24','25','26','27','28','30' ,'90')
GROUP BY A.PRIME_BANK,A.ITEM_NUMBER,A.ITEM_DESC,A.CARD_TYPE ,
A.OLD_ITEM_NUMBER,A.NEW_ITEM_NUMBER, B.TRAN_CODE, B.ITEM_NUMBER