We have an inventory management system which consists of an Item Catalog, Inventory, and Assets. Currently, we have an entry for every piece of inventory but we are now implementing a quantity on both the Inventory table and Assets table. For instance, data in the Inventory table looks something like this:
InventoryID | ItemID
----------------------
100 | 5
101 | 5
102 | 5
103 | 5
104 | 9
105 | 5
What we now want to do is to merge the records with the same ItemID and put the Quantity in the field:
InventoryID | ItemID | Quantity
---------------------------------
100 | 5 | 5
104 | 9 | 1
I have thousands of records that need merging and would like to know of a faster way to do this instead of the current way, which is finding the records, getting the count, deleting all but the latest record and updating the quantity field with the count (all being done manually in SSMS, not through any scripts).
Any help/suggestions would be appreciated.