UPDATE foo SET myField = (SELECT SUM(myField) FROM foo WHERE ikey LIKE '1%' AND ikey != '100') SET myField1 = (SELECT SUM(myField1) FROM foo WHERE ikey LIKE '1%' AND ikey != '100') SET myField2 = (SELECT SUM(myField2) FROM foo WHERE ikey LIKE '1%' AND ikey != '100') -- ETC WHERE iKey='100'My thanks again for your help,
>-- Roll up the values >DECLARE @rollup int >select > @rollup = sum(MyField) >from foo > where left(IKey,1) = '1' > > -- insert the rolled up values > update foo > set > MyField = @RollUp >where IKey = '100' >>
>UPDATE foo >SET myField = (SELECT SUM(myField) FROM foo WHERE ikey LIKE '1%' AND ikey != '100') >WHERE iKey='100' >>
"If ye love wealth better than liberty, the tranquility of servitude better than the animated contest of freedom, go home from us in peace. We ask not your counsel or arms. Crouch down and lick the hands which feed you. May your chains set lightly upon you, and may posterity forget that ye were our countrymen."
~Samuel Adams