Link to home
Start Free TrialLog in
Avatar of Gunit2507
Gunit2507

asked on

Delete Rows From Database

Hello,
I have two tables (Employees and Records) that both contain a FirstName and LastName column.  I want to create a Delete Query that will delete every row in the Employee's table where a data row's FirstName and LastName is not found in the Records table.
Avatar of spprivate
spprivate
Flag of United States of America image

delete from employees where firstname+lastname not in
(select firstname+lastname from records).
But I would say this is a bad design and rather I would have Emp ID as a key in the child table and delete by the id.
Avatar of Gunit2507
Gunit2507

ASKER

The other database doesn't have an employee ID or any value like that... So how would that look in SQL?
you can use the same query as i mentioned earlier
ASKER CERTIFIED SOLUTION
Avatar of anyoneis
anyoneis
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial