I am trying to join several tables using a left join. My objective is search and delete orphan rows. This orphan rows exist on table A. In order to find them I left join this table to tables B and C. This join hangs indefinitely. The problem, somehow, seems to be in joining table A to table C. To determine this I have tested independent select statements using the left join on B and on C. The left join on C works just fine but not that on B. If I do an inner join on B it works just fine, though. The following is my statement, I truly do not understand why it does not work. If anyone could suggest something I would appreciate it.
Delete A.*
From A left join B on A.id = B.Aid
left join C on A.id = C.Aid
Where A.id is not null and B.AID is null and C.Aid is null
Leaving the where clause out of the statement does not help.
the only difference between the tables is that the key (Aid) on C shows to be Mul but on B it does not. Nevertheless, I do not know why would that make any difference.
Thank you,
j
Delete A.*
From A left join B on A.id = B.Aid
left join C on A.id = C.Aid
Where A.id is not null and B.AID is null and C.Aid is null
Leaving the where clause out of the statement does not help.
the only difference between the tables is that the key (Aid) on C shows to be Mul but on B it does not. Nevertheless, I do not know why would that make any difference.
Thank you,
j