Home Page for the TeradataForum
 
 

 

Archives of the TeradataForum





Message Posted: Mon, 17 Mar 2003 @ 15:40:56 GMT





     
  <Prev Next>   <<First <Prev Next> Last>>  




Subj:   Re: Alternate way to Cursor
 
From:   Babu, Mahesh



Ramesh,

You can achieve this by using LEFT OUTER JOIN's and COALESCE.

For Eg:

SELECT
MAIN_KEY
,COLAESCE(TBL1.COL,DEFAULT_VALUE)
,COLAESCE(TBL2.COL,DEFAULT_VALUE)
,COALESCE(TBL3.COL,DEFAULT_VALUE)
-
-
-
FROM
MAIN_TABLE /* DRIVER TABLE*/
LEFT OUTER JOIN
TBL1
ON MA_IN_TABLE.KEY = TBL1.KEY
LEFT OUTER JOIN
TBL2
ON MAIN_TABLE.KEY = TBL2.KEY
LEFT OUTER JOIN
TBL3
ON  MAIN_TABLE.KEY = TBL3.KEY
-
-
-
-

You can even add more conditions to your tables by using derived tables.


Thanks

Mahesh





     
  <Prev Next>   <<First <Prev Next> Last>>  
 
 
 
 
 
 
 
 
  
 
  Top Home Join Privacy Feedback  
 
 
Copyright for the TeradataForum (TDATA-L), Manta BlueSky 
Last Modified: 30 Jun 2008