try this,create table #s (productID int,productCode int,productDescription varchar(1000),description_match int)Goinsert into #sselect 13575,40000,'Nutrition Shake,Chocolate Cream',1 union allselect 35650,40000,NULL,0 union allselect 13583,40004,'Nutrition Shake,Vanilla Cream',1 union allselect 35667,40004,NULL,0 Goupdate aset productDescription=(select top 1 productDescription from #s where productCode=a.productCode and productDescription is not null)from #s a