Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
Posted: Tue Nov 05, 2013 12:40 pm Post subject:
Kavi,
Try this
Code:
SELECT A.PRODUCT_ID
,A.PRODUCT_CATEGORY
,A.PROD_TYPE
,A.REGION_TYPE
,B.DISCOUNT_APPLY
,B.BULK_APPLY
,C.SUB_PRODUCT01
,C.SUB_PRODUCT02
,C.SUB_PRODUCT03
,C.SUB_PRODUCT04
,C.SUB_PRODUCT05
,C.SUB_PRODUCT06
,C.SUB_PRODUCT07
,C.SUB_PRODUCT08
,C.SUB_PRODUCT09
,C.SUB_PRODUCT10
FROM Master_Product A
,Other_ LOB B
,(SELECT Z.PRODUCT_ID
,Z.PRODUCT_CATEGORY
,MIN(CASE WHEN Z.RN = 01 THEN Z.SUB_PRODUCT END)
SUB_PRODUCT01
,MIN(CASE WHEN Z.RN = 02 THEN Z.SUB_PRODUCT END)
SUB_PRODUCT02
,MIN(CASE WHEN Z.RN = 03 THEN Z.SUB_PRODUCT END)
SUB_PRODUCT03
,MIN(CASE WHEN Z.RN = 04 THEN Z.SUB_PRODUCT END)
SUB_PRODUCT04
,MIN(CASE WHEN Z.RN = 05 THEN Z.SUB_PRODUCT END)
SUB_PRODUCT05
,MIN(CASE WHEN Z.RN = 06 THEN Z.SUB_PRODUCT END)
SUB_PRODUCT06
,MIN(CASE WHEN Z.RN = 07 THEN Z.SUB_PRODUCT END)
SUB_PRODUCT07
,MIN(CASE WHEN Z.RN = 08 THEN Z.SUB_PRODUCT END)
SUB_PRODUCT08
,MIN(CASE WHEN Z.RN = 09 THEN Z.SUB_PRODUCT END)
SUB_PRODUCT09
,MIN(CASE WHEN Z.RN = 10 THEN Z.SUB_PRODUCT END)
SUB_PRODUCT10
FROM (SELECT PRODUCT_ID
,PRODUCT_CATEGORY
,SUB_PRODUCT
,ROWNUMBER() OVER (PARTITION BY PRODUCT_ID,
PRODUCT_CATEGORY) AS RN
FROM Network) Z
GROUP BY Z.PRODUCT_ID
,Z.PRODUCT_CATEGORY) C
WHERE A.PRODUCT_ID = B.PRODUCT_ID
AND A.PRODUCT_CATEGORY = B.PRODUCT_CATEGORY
AND A.PRODUCT_ID = C.PRODUCT_ID
AND A.PRODUCT_CATEGORY = C.PRODUCT_CATEGORY
;
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum