[AccessD] SQL DEVELOPER question - running a delete query in a loop

Benson, William (GE Global Research, consultant) Benson at ge.com
Wed Sep 12 12:07:52 CDT 2012


HA... Now both of these work fine:

I... am.... going ... crazy ....


The one I thought worked before, then delays started happening, and now works again:

Delete from sid_user_sites
where user_site_id not in
( select MinID from
( Select user_sso, site_duns_no, min(user_site_id) MinID from sid_user_sites group by user_sso, site_duns_no
)
);

And this one which I found on the net:
http://viralpatel.net/blogs/deleting-duplicate-rows-in-oracle/


DELETE FROM sid_user_sites t 
WHERE t.ROWID NOT IN 
(SELECT MIN (b.ROWID) FROM sid_user_sites b
WHERE b.user_sso = t.user_sso 
     AND b.site_duns_no = t.site_duns_no
);




More information about the AccessD mailing list