Ask a Question related to Dreamweaver AppDev, Design and Development.
-
darrel #1
SQL: Deleting child records recursively
I have a table of records that share a parent/child relationship. Ie:
id | parentID | item
1 | 0 | main item
2 | 1 | secondary item
3 | 2 | tertiary item
If I delete item 1, I then want to automatically delete items 2 and 3, since
they are children of 1.
I was going to do a recursive function that deletes item 1, then goes into
the db, looking for any item that had '1' as a parent id, delete them, and
then repeat down the chain. Not a big deal, but thought I'd ask if there was
already perhaps a built in SQL command that would do this in one query.
-Darrel
darrel Guest
-
Deleting multiple records
Here's what I have... A table with 3 columns. Headings are (Name, Prayer Request, and Delete). A loop that goes through a Record Set and prints... -
Deleting duplicate records
Jon, You didnt supply the DDL, so I can only point to existing practices to remove duplicate records.Here they are: INF: How to Remove... -
Deleting records against a list
Let's say I have a database of 10,000 contacts. I send email out to them all and 200 of them bounce back. I collect those 200 bounces and parse... -
deleting records and keeping them
hi i just wanted to know does any one if there is a way of deleting a record but also when the record is deleted it is lept in another file so that... -
deleting selection of records
I have a page that populates with a set of records based on url parameters that are passed to it and it works great. I have added a checkbox and... -
Julian Roberts #2
Re: Deleting child records recursively
I tend to use the logic from this article
[url]http://www.sqlteam.com/item.asp?ItemID=8866[/url]
Then have SQL like
delete from t where lineage like '%/100/%'
--
Jules
[url]http://www.charon.co.uk/charoncart[/url]
Charon Cart 3
Shopping Cart Extension for Dreamweaver MX/MX 2004
Julian Roberts Guest



Reply With Quote

