Wednesday, June 27, 2012

SQL Quick Reference

Update using From Clause
Most of the time we need to update table using reference from another table where we need to do join. The SQL query used in Netezza/teradata is slightly different than oracle. The syntax for Netezza is as
update tbl1 a
    SET a.col1=b.col1
FROM (select col1,col2 from tbl2) B
    WHERE a.col2=b.col2