Index: trunk/ippTools/share/dettool_pendingcleanup_stacked.sql
===================================================================
--- trunk/ippTools/share/dettool_pendingcleanup_stacked.sql	(revision 25299)
+++ trunk/ippTools/share/dettool_pendingcleanup_stacked.sql	(revision 25324)
@@ -1,9 +1,20 @@
 SELECT DISTINCT
     detStackedImfile.*,
-    detRunSummary.data_state
+    rawExp.camera
 FROM detRunSummary
 JOIN detStackedImfile
-    USING(det_id,iteration)
+     USING(det_id,iteration)
+JOIN detInputExp
+     USING(det_id,iteration)
+JOIN rawExp
+     USING(exp_id)
 WHERE
-    detRunSummary.data_state = 'goto_cleaned'
-AND detStackedImfile.data_state = 'full'
+    ((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'
+     OR detStackedImfile.data_state = 'goto_scrubbed'
+     OR detStackedImfile.data_state = 'goto_purged')
