Anyone knws how to amend this query doesnt check that HseName in Table t1 is not in Table t2 & t3 before deletion.
Table Details:
t1
HseName
------------
Grace House
t2 & t3
HseName
------------
Evergreen/London/Grace House
Code:
Delete a from t1 a left join t2 b on b.HseName LIKE '%'+a.HseName+'%'
left join t3 c on c.HseName LIKE '%'+a.HseName+'%'
where a.HseName='Grace House' and b.HseName is null and c.HseName is Null