noodles1
Programmer
- Oct 31, 2001
- 58
I seem to have a problem with a Update using a correlated subquery. When I run the following:
UPDATE Agtable1 t1
SET t1.ztAddr_Line1 = (select t2.Addr_Line1 from Address t2
where t2.Addr_Type = t1.ztAddr_Type AND
t2.Addr_Ident Code1 = t1.ztagree_no )
the subquery is returning 0 rows thus the column in t1 is being set to NULL.
However running a simple select that joins t1 and t2 using the same join condition as the subquery, returns the expect number of rows.
Am I missing something here? Any ideas?
UPDATE Agtable1 t1
SET t1.ztAddr_Line1 = (select t2.Addr_Line1 from Address t2
where t2.Addr_Type = t1.ztAddr_Type AND
t2.Addr_Ident Code1 = t1.ztagree_no )
the subquery is returning 0 rows thus the column in t1 is being set to NULL.
However running a simple select that joins t1 and t2 using the same join condition as the subquery, returns the expect number of rows.
Am I missing something here? Any ideas?