Relative Content

Tag Archive for sqlsql-serveraggregate-functions

How do I update a database table, to remove duplicates, with data from another table in SQL Server?

I’m trying to do what I feel is a fairly complex update statement and the solution feels like it’s just outside my grasp. Anyway, consider the following two tables. Val1, Val2, and Val3 are combined to make a unique code. These are then tied to “Items” from another table (not depicted here, but only referenced by ItemId). Finally, another table has references to both the Table1 unique codes as well as the Items.