Below are the list data.
Code ItemCount Type Amount ---------------------------------------- B001 1 Dell 10.00 B001 1
You can try this simpler solution:
select Code,sum(ItemCount),Type,sum(Amount) from table group by code,type
Understanding the 'group by' would come handy