04 Oct 19 · npack · #Snowflake ·   Bookmark   ×

Merge command syntax in Snowflake

Inserts, updates, and deletes values in a table based on values in a second table

merge into t1 using t2 on t1.t1key = t2.t2key
when matched and t2.marked = 1 then delete
when matched then update set val = t2.newval
when not matched then insert (val, status) values (t2.newval, t2.newstatus);


posted on 04 Oct 19

Enjoy great content like this and a lot more !

Signup for a free account to write a post / comment / upvote posts. Its simple and takes less than 5 seconds