hello there,
i have two data tables, one is depending on the other. now i need to delete the main table row depending on the subtable row if it is null. please see my attachment.
:banghead::banghead:
I wouldn't be too dismissive of jdraw's suggestion. You say you're not satisfied with his reply; is it the case you didn't understand his reply? There is a difference.
Anyway, try this:
Code:
DELETE tblEmployee.EmployeeID
FROM tblEmployee
WHERE tblEmployee.EmployeeID
NOT IN
(Select EmployeeID FROM tblAddress);
I made an assumption regarding the Address table and field name, change accordingly. The SQL can be made less verbose but it is a starting point for you.
TIP: Before you start messing around with Delete Queries, first test with a normal SELECT query, this will reveal which records will be deleted without actually deleting them.