update a set a.qty=(select sum(qty) from test b where b.TARGETDATE<=a.Targetdate and
category1='A1' and category2='B1') from test a where category1='A1' and category2='B1'
category1='A1' and category2='B1') from test a where category1='A1' and category2='B1'