Update itemdynamic set taxid=1 where (storeid=230 and itemid in (select [id] from item where departmentid != 49))