benjamenus
Programmer
I have 2 tables:
t1 (100 rows) has columns a,b,c (combined a,b,c make each row unique)
t2 (5 rows) has columns a,b,c,d (a,b,c or a,b,d make each row unique)
t2 (a,b,c) was created from t1 (a,b,c) so linking on these three fields means that there can only be one matching row in t1 for every row in t2.
The update (obviously not written like this) is basically:
update t1.c with t2.d
where t1.a=t2.a
and t1.b=t2.b
and t1.c=t2.c
From this I would expect 5 rows to be updated in t1. However, this violates the unique constraint in t1.
What I need to do is identify which row(s) / value(s) are causing this but cannot seem to get the right query.
t1 (100 rows) has columns a,b,c (combined a,b,c make each row unique)
t2 (5 rows) has columns a,b,c,d (a,b,c or a,b,d make each row unique)
t2 (a,b,c) was created from t1 (a,b,c) so linking on these three fields means that there can only be one matching row in t1 for every row in t2.
The update (obviously not written like this) is basically:
update t1.c with t2.d
where t1.a=t2.a
and t1.b=t2.b
and t1.c=t2.c
From this I would expect 5 rows to be updated in t1. However, this violates the unique constraint in t1.
What I need to do is identify which row(s) / value(s) are causing this but cannot seem to get the right query.