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