Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
benricho
Yak Posting Veteran
84 Posts |
Posted - 2002-03-25 : 18:20:02
|
I want to delete a staff member, and I also have to delete their entries from the appointment table and the appRecurrence table. The appointment table is linked to the staff table by appointment.appStaffID = staff.staffID, and appRecurrence table linked to the appointment table by appRecurrence.appID = appointment.appID. The trouble I'm having is how can I delete the values in the appRecurrence table?Edited by - benricho on 03/25/2002 18:22:27 |
|
|
Merkin
Funky Drop Bear Fearing SQL Dude!
4970 Posts |
Posted - 2002-03-25 : 19:01:29
|
HiYou need two delete statements.Declare @staffID intSET @staffId = 1DELETE FROM appRecurrenceFROM --note the second from clauseappRecurrenceINNER JOIN appointment ON appointment.appID = appRecurrence.appIDINNER JOIN staff ON staff.staffID = appointment.appStaffIdWHEREstaff.staffID = @staffID-- Note the last join is a little redundant, just there to demonstate the techniqueDELETE FROM appointment WHERE appStaffID = @staffID Hope that helpsDamian |
 |
|
|
benricho
Yak Posting Veteran
84 Posts |
Posted - 2002-03-25 : 19:08:25
|
| Thanks Damien, I didn't know about the second FROM clause technique, worked like a charm. |
 |
|
|
|
|
|