Archives of the TeradataForum
Message Posted: Thu, 03 Mar 2005 @ 10:10:16 GMT
Subj: | | Update/Insert (Upsert) |
|
From: | | kumar28 |
All,
I am trying to use Update/Insert (Upsert) in one of my query..... I get a message saying I cannot use select with Insert in Upsert statement. I
have to use select statement with Insert as it goes against multiple tables.....
Is there a way to update/insert in the scenario given below. I will really appreciate any ideas resolving this.....
update table1
set
table1.col1= table2.col1
table1.col2 =table2.col1
table1.col3 =table2.col3
where
table1.col1 = table2.col1
and table1.col2 =table2.col1
ELSE
Insert into table1
select
case statement.......table2.col1,
case statement.......table3.col2,
case statement.......table3.col3
from
table3 Left outer join table2
on table3.col1 =table2.col1
where
conditions.......
Thanks
Raj
|