Archives of the TeradataForum
Message Posted: Thu, 25 Mar 2004 @ 09:25:53 GMT
I have a column in my select statement that I will like to populate with values from either of two tables in a multiple-join SQL. For example, if data in a certain column of join condition(1), populate col1 with it else use data from join condition(2) to populate col1. I have been thinking of a good efficient way to do this and I could use the help of our SQL gurus on this column.
Here's the SQL I'm trying to use as a example,
SELECT col1, col2,... coln From BA.DLY_LN_ACCNT LA (1) Join BACURRENT.Ln_Dt_Rng LDR On LA.process_dt = LDR.end_extract Join BA.Dly_AccNT A (2) On A.ba_accnt_nbr = LA.ba_accnt_nbr And A.process_dt = LA.process_dt Join BA.Dly_Accnt_Risk AR (3) On A.ba_accnt_nbr = AR.ba_accnt_nbr And A.process_dt = AR.process_dt Join ba.Dly_Ppant PART (4) On PART.ba_accnt_nbr = A.ba_accnt_nbr And PART.process_dt = A.process_dt ;
Again, your contributions is always appreciated.
|Copyright 2016 - All Rights Reserved|
|Last Modified: 27 Dec 2016|