Index: trunk/ippTools/share/dettool_pendingcleanup_residexp.sql
===================================================================
--- trunk/ippTools/share/dettool_pendingcleanup_residexp.sql	(revision 25324)
+++ trunk/ippTools/share/dettool_pendingcleanup_residexp.sql	(revision 26815)
@@ -1,20 +1,12 @@
-SELECT
+SELECT DISTINCT 
     detResidExp.*,
     rawExp.camera
-FROM detRunSummary
-JOIN detResidExp
-    USING(det_id,iteration)
+FROM detResidExp
 JOIN detInputExp
-     USING(det_id,iteration,exp_id)
+     USING(det_id,exp_id)
 JOIN rawExp
     USING(exp_id)
 WHERE
-    ((detRunSummary.data_state = 'goto_cleaned'
-      AND detResidExp.data_state = 'full')
-     OR (detRunSummary.data_state = 'goto_scrubbed'
-         AND detResidExp.data_state = 'full')
-     OR (detRunSummary.data_state = 'goto_purged'
-         AND detResidExp.data_state = 'full')
-     OR detResidExp.data_state = 'goto_cleaned'
+    (detResidExp.data_state = 'goto_cleaned'
      OR detResidExp.data_state = 'goto_scrubbed'
      OR detResidExp.data_state = 'goto_purged')
