Archives of the TeradataForum
Message Posted: Thu, 25 Mar 2004 @ 18:57:43 GMT
| Subj: || || Re: Populating one column with data from either of two table. |
| From: || || Scott Thompson |
| ||I have been thinking of a good efficient way to do this and I could use the help ...|| |
is this perhaps what you're looking for? :
SELECT (CASE WHEN LA.column_to_check = 'what i want'
WHEN A.column_to_check = 'meets secondary conditions'
WHEN LA.column_to_check2 = A.column_to_check2
ELSE 'stick generic message in col1'
END) as col1,
col3, .... coln
From BA.DLY_LN_ACCNT LA, BACURRENT.Ln_Dt_Rng LDR,
BA.Dly_AccNT A, BA.Dly_Accnt_Risk AR,
WHERE LA.process_dt = LDR.end_extract
AND A.ba_accnt_nbr = LA.ba_accnt_nbr
And A.process_dt = LA.process_dt
AND A.ba_accnt_nbr = AR.ba_accnt_nbr
And A.process_dt = AR.process_dt
AND PART.ba_accnt_nbr = A.ba_accnt_nbr
And PART.process_dt = A.process_dt
obviously, change the column names, comparison conditions, and return values in the case statement to something more specific to your
actual tables and columns and suitable to your needs.