Help on update query

  • suppose I have a table that store the values of zip codes and sales tax rates for each zip code. Let's call this table [regional_Tax_Rate]. Thus [regional_Tax_Rate] has 2 columns zipcode and taxrate. I have another table that also has 2 columns. This table contains updated tax rates for each zip code. My [Updated_Tax_rate] table has 2 columns: 1) zipcode

    2) updated_tax_rate. How can I update the values of taxrate column in my [regional_Tax_Rate] table with the values updated_tax_rate in my [Updated_Tax_rate] for each matching zip code in two tables?

    Faye

  • The form of update that has a from clause is probably what you need.

    update table1

    set col2 = table2.col2

    from table1 inner join table2 on table1.col1 = table2.col1

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • Thank you so much

    faye

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply