OK, I have two tables and I need to delete some information from one table depending on information in another table.
To make it easy, let's call the two tables T1 and T2.
T1 has fields F1, F2, F3
T2 has fields F4, F5, F6 & F7
I need to delete all records in T2 where F4=F1, F5=F2 and F3 (in T1) = 'D'.
I have almost got it working using a DELETE Statement with a WHERE EXISTS criteria but it is trying to delete ALL records in T2, not just thise where F3 = 'D'.
If I 'run' my WHERE Exists criteria as a SELECT statement it pulls back the correct records but when I add it to my DELETE statement it wants to delete everything.
Any ideas?
Many Thanks.
To make it easy, let's call the two tables T1 and T2.
T1 has fields F1, F2, F3
T2 has fields F4, F5, F6 & F7
I need to delete all records in T2 where F4=F1, F5=F2 and F3 (in T1) = 'D'.
I have almost got it working using a DELETE Statement with a WHERE EXISTS criteria but it is trying to delete ALL records in T2, not just thise where F3 = 'D'.
If I 'run' my WHERE Exists criteria as a SELECT statement it pulls back the correct records but when I add it to my DELETE statement it wants to delete everything.
Any ideas?
Many Thanks.