You want cascade deletion via foreign keys.

http://dev.mysql.com/doc/refman/5.1/en/ansi-diff-foreign-keys.html

is one such place to learn more.

Tim

> -----Original Message-----
> From: Chris W. Parker [mailto:[EMAIL PROTECTED]
> Sent: Monday, August 07, 2006 9:11 PM
> To: mysql@lists.mysql.com
> Subject: Delete one record, automatically delete other records...
> 
> Hello,
> 
> I'm not sure if this is possible (or what it's called, and how to search
> for it) at the db layer or if this has to be done at the application
> layer... I would like to be able to delete one record in one table and
> then automatically (without making an extra call to the db) delete other
> records. If I'm using this term correctly, I think I'm trying to avoid
> having orphan records.
> 
> In my specific case I want to delete a product from my database and then
> automatically delete all associated records like the category and
> manufacturer relationships.
> 
> BTW, I'm using MySQL 4.1.20.
> 
> I'm not really looking for code snippets but rather the name for this
> idea and/or links so I can rtfm. :)
> 
> 
> 
> Thanks,
> Chris.
> 
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to