Ah... Yes. Good point. I like this because I was planning on keeping the output somewhere for a while. (In case we need an "accounting" at some point) So it will be easy enough to dump what's being deleted to the screen while we loop over our candidates.
Thanks! On Tue, Jul 14, 2009 at 10:16 AM, Nathan Sullivan<nsulli...@cappex.com> wrote: > If you went with option #3, you could avoid the looping by using (tCount - 1) > as the LIMIT in > the delete statement instead of always using 1. >> 3. Do... "SELECT count(*) AS tCount,OrgID,ContID FROM OrgContLink >> GROUP BY OrgID,ContID HAVING tCount > 1". Then for every record in the >> result "DELETE FROM OrgContLink WHERE OrgID=X AND ContID=Y LIMIT 1". >> Then repeat until no results are found. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/mysql?unsub=arch...@jab.org