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