AkAlan
asked on
SQL delete procedure
I have a table that I am trying to clean up using a delete procedure.
Table name is TR
Columns are TR_ID,EmployeeID,TrainingI D
I need to delete the row where the employee has a record with TrainingID = 171 ONLY if the employee has a record with a TrainingID = 113
Any help would be appreciated.
Table name is TR
Columns are TR_ID,EmployeeID,TrainingI
I need to delete the row where the employee has a record with TrainingID = 171 ONLY if the employee has a record with a TrainingID = 113
Any help would be appreciated.
DELETE FROM TR WHERE TrainingID = 171 AND (SELECT COUNT(*) FROM TR TR2 WHERE TR2.TR_EmployeeID = TR.EmployeeID) > 0
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.