I create a temporary table that I want to delete all the orphan childs that do not have parents except the '00-%' top levels
--create table CREATE INMEMORY TABLE tmpbomtree (tid INTEGER, tparentid INTEGER, pvpntitle + TEXT 75, tpvimage INTEGER) --insert all rows INSERT + INTO tmpbomtree (tid, tparentid, tpvimage) SELECT pvplpartid, pvpllistid, 1 + FROM pvpl WHERE pvplpartid IN (SELECT PVPNID FROM pvpn + WHERE modyear = .vmodyear AND pvpntype = 'pl') --update title UPDATE tmpbomtree SET pvpntitle = (t2.pvpnpartnumber + '-' + t2.pvpntitle) + FROM tmpbomtree t1, pvpn t2 WHERE t1.tid = t2.pvpnid --remove top levels that do not start with 00 --create temp table to look at to delete(which is a copy of tmpbomtree) PROJECT INMEMORY tmpbompi FROM tmpbomtree USING tid tparentid DELETE ROWS FROM tmpbomtree + WHERE pvpntitle NOT LIKE '00-%' AND tparentid NOT IN (SELECT tid FROM tmpbompi) When I run this it only deletes a portion of the rows. I have to run the delete command many times until they are all gone. Any Ideas or tips? Dan Goldberg -- For group guidelines, visit http://www.rbase.com/support/usersgroup_guidelines.php --- You received this message because you are subscribed to the Google Groups "RBASE-L" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion visit https://groups.google.com/d/msgid/rbase-l/PH3PPF5FDE66ECBC110752666339EBE3E9BD4082%40PH3PPF5FDE66ECB.namprd10.prod.outlook.com.

