sql - How to delete rows in a Teradata table that are not in another table? -


what makes situation tricky don't have single column key, simple list of primary keys delete (for instance, "delete table key in ([list])"). have multiple columns primary key, , need join on of them.

using know of other databases, thought might done as:

delete     table1 t1   left outer join       table2 t2     on       t2.key1 = t1.key1 ,       t2.key2 = t1.key2       t2.key1 null; 

but teradata (v12) responds error number 3706, saying "syntax error: joined tables not allowed in clause."

found done by:

delete     table1       (key1, key2) not in (       select unique key1, key2 table2     ); 

Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -