Page 1 of 1

Delete from multiple tables in one query prt 2

Posted: Tue Aug 30, 2005 1:09 pm
by kendall
Hey,

this is a continuation question from a posting i was reading in viewtopic.php?t=23774&highlight=delete+multiple

Now i have used

Code: Select all

DELETE FROM products, price_options, product_options USING products, price_options, product_options WHERE product_options.ProductID = products.ProductID AND price_options.ProductID = products.ProductID AND products.ProductID = 'test'
with much success but this is for delete relating information among the tables

but at the moment i am trying to apply this to tables that MAY NOT have related information. To put it more in sentance term.
Im trying to delete related data in tables that may or may not have matches.
I have been experimenting with the LEFT JOIN syntax of it but im sooo not getting the whole concept of LEFT JOIN when SELECT far less for using it with DELETE but how does the LEFT JOIN work in terms of precedence with DELETE?

What would be a solutions of DELETE multiple tables that may or may not have related data?

Kendall[/url]

Posted: Wed Aug 31, 2005 7:18 am
by Jean-Yves
If your table type supports them, set up cascading deletes in the relationships.

Cascading DELETES?

Posted: Mon Sep 12, 2005 2:58 pm
by kendall
What in the BLUE HELL is
cascading DELETES?

Posted: Mon Sep 12, 2005 4:58 pm
by feyd
cascading deletes are ones using foreign keys set up such that "on delete" they destroy themselves too. Tightly tied records. :)

USING foreign keys

Posted: Wed Sep 14, 2005 3:02 pm
by kendall
Unfortunately i am unable to impliment the foreign keys thingy


What to doooo what too doooooooooooooo :cry: