Here is my first crack... I have to run, but im sure we can come up with something a bit more elegant tomorrow
Does this do what we want?set nocount ondeclare @table table (dt datetime, value varchar(50))insert into @table (dt, value)select '2005-03-25', '0.12866403372827406' union allselect '2005-03-28', '0.12866403372827406' union allselect '2005-03-29', '0.12866403372827406' union allselect '2005-03-30', '0.99999999999999999' union allselect '2005-03-31', '0.21755070072822402 *******' union allselect '2005-04-01', '0.12000000000000000' union allselect '2005-04-01', '0.12000000000000000' union allselect '2005-04-02', '0.12000000000000111'select * from @table order by dt-------------------------------- do the update------------------------------update tset value = dd.valuefrom @table tinner join ( select max(dt) mdt, value, count(*) cnt from @table group by value having count(*) = 1)don t.dt = d.mdtleft join ( select max(dt) mdt, value, count(*) cnt from @table group by value having count(*) > 1)ddon t.dt > dd.mdtselect * from @table order by dt
Nathan Skerl