Archives of the TeradataForum
Message Posted: Tue, 19 Jul 2005 @ 09:22:58 GMT
I am doing a full outer join of two tables C & P (same columns) and inserting into a new table T (same columns again, plus and additional updatestatus column), I want to make sure that if a particular column in C is NULL then insert that column from P or use C.
This being my requirement should I go for COALESCE or CASE statment ?
COALESCE (C.PKEY, P.PKEY) COALESCE (C.COL1, P.COL1) COALESCE (C.COL2, P.COL2) ...
CASE WHEN C.PKEY IS NULL THEN P.KEY ELSE C.PKEY END AS PKEY CASE WHEN C.COL1 IS NULL THEN P.COL1 ELSE C.COL1 END AS COL1 ...
All the columns in all tables are defined as NOT NULL. and the outer join is on the PKEY column ...
Any ideas as to how to get things going faster ?
|Copyright 2016 - All Rights Reserved|
|Last Modified: 28 Jun 2020|