Monday, February 26, 2007

Update a table from another table

  1. update (select a.cellularnumber aaaphone, b.telephone2 cusphone from aaa_customers a, anacustomer b where a.hnno=b.hn) set cusphone=aaaphone
##CONTINUE##
  1. update anacustomer b set telephone2 = ( select cellularnumber from aaa_customers a where a.hnno=b.hn ) where b.hn in ( select a.hnno from aaa_customers a where a.hnno=b.hn )

  2. update anacustomer b set telephone2 = ( select cellularnumber from aaa_customers a where a.hnno=b.hn ) where EXISTS ( select hnno from aaa_customers a where a.hnno=b.hn )

Read more!

No comments: