sql - Update a row with data from a joined table where each row is different -


i update column in table value different every row. value want update table obtained inner join table. how go updating each row value obtained join, on row row basis?

here example ....

divisionid    divisionname          licenseno ---------------------------------------------- 1             crimminal law         null 2             civil law             null 3             corporate law         null   practiceid      divisionid     practicename     licenseno ---------------------------------------------------------- 11                 1           law firm       243527 12                 2           law firm b       364802 13                 3           law firm c       394843   select practice.licenseno practice inner join division     on division.divisionid = practice.divisionid 

i know how values want unsure how practice.licenseno licenseno field in division table. using sql server 2012.

try this.

update division set licenseno=practice.licenseno division  inner join practice    on division.divisionid = practice.divisionid 

Comments

Popular posts from this blog

database - VFP Grid + SQL server 2008 - grid not showing correctly -

jquery - Set jPicker field to empty value -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -