Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I Delete from Multiple Tables based on a Select Query 1

Status
Not open for further replies.

LeonelSanchezJr

Programmer
Jan 26, 2001
522
US
This query brings back all of the records that I need to delete. How can I delete all of these records across 3 tables?

:cool:

select * from DESK_ALL
join DESK on DESK_ALL.NUMBER = DESK.NUMBER
join NOTES on DESK.iKEY = NOTES.id
join SOLUTIONS on DESK.iNOTESKEY = SOLUTIONS.id
where 'TEST' in (cRECORDEDBY)

 
one way would be to create a 'delete' trigger on the "desk_all" table, then all you need to do is a delete and the rest would follow through..... Paul
 
Hi Leonelsanchezjr,
This will help you in deleting rows from DESK_ALL table, depending on your query.
----------------------------
DELETE DESK_ALL
FROM DESK_ALL
join DESK on DESK_ALL.NUMBER = DESK.NUMBER
join NOTES on DESK.iKEY = NOTES.id
join SOLUTIONS on DESK.iNOTESKEY = SOLUTIONS.id
where 'TEST' in (cRECORDEDBY)
----------------------------

May this help you!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top