Quantcast
Channel: Teradata Forums - Database
Viewing all articles
Browse latest Browse all 14773

Tearadata SQL Help - Very much Urgent - response (6) by reddy27

$
0
0
  Thanks a lot for the reply aftab, I have written a query like below, I didn't quite understand what you are saying..could you please modify below script with what you are saying - i would really appreciate that..thanks once again bhai       SELECT   (200000000000 + B.MAXID + ROW_NUMBER() OVER (ORDER BY SOR_PROD_CD)) AS LEAD_KY                 ,V.PRODUCT_1 AS SOR_PROD_CD                 ,COALESCE (LVL.PROD_CAT_LVL_1_NM, '-1') AS PROD_CAT_LVL_1_NM                  ,CURRENT_TIMESTAMP(0) AS AUD_INSRT_DT_TM                 ,USER AS AUD_INSRT_USR_ID                 FROM  T_CNTCT_HIST C                         JOIN  (SEL PRODUCT_1, PRODUCT_2, PRODUCT_3, PRODUCT_4, PRODUCT_5,PRODUCT_6, PRODUCT_7, PRODUCT_8, PRODUCT_9, PRODUCT_10, OFFERCODE1                                 FROM OFFERATTRIBUTE) V                 ON  C.VERS_ID = V.OFFERCODE1                         JOIN  BTNG.T_PROD_X_OTH_HIER_PROD PRD                 ON  V.PRODUCT_1 = PRD.OTH_HIER_CHAR_PROD_CD AND                 PRD.EXPIR_DT = '9999-12-31'  AND                 OTH_HIER_KY = 14                         JOIN  BTNG.T_PROD_DEF DEF                 ON DEF.PROD_KY = PRD.PROD_KY                 AND DEF.EXPIR_DT = '9999-12-31'                 AND PRD.EXPIR_DT = '9999-12-31'                         JOIN  BTNG.T_PROD_CAT_LVL_1_DEF LVL                 ON  DEF.PROD_CAT_LVL_1_KY = LVL.PROD_CAT_LVL_1_KY                 CROSS  JOIN                 (SELECT COALESCE(MAX(LEAD_KY),0) MAXID FROM T_EMAIL_CCLR_PROD) B   Input row: PRODUCT_1, PRODUCT_2, PRODUCT_3, PRODUCT_4, PRODUCT_5 FROM THE ABOVE QUERY I'm assigned PRODUCT_1 to SOR_PROD_CD, same way I need to assign all other 4 products to same surrogate key..thank you

Viewing all articles
Browse latest Browse all 14773

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>