I have two tables:
Table1:
[id], [ColA]
Table2:
[id], [Table1Id]
A previous update caused duplicates in Table1 and those duplicates to be assocated with rows in Table2. It looks like this in the db:
Table1
1, 89
2, 89
Table2
6, 1
7, 2
I would like to delete the duplicates and reassign the value of the Table2.Table1Id
to the one Table1.id
row that should be left. Is this possible in a single statement? Ive seen this post on how to delete all but one, but I am lost on how to reassign the Table2.Table1Id
value.
edit: The end result should look like this:
Table1
2, 89
Table2
6, 2
7, 2