Index: branches/czw_branch/cleanup/ippTools/share/addtool_find_pendingexp.sql
===================================================================
--- branches/czw_branch/cleanup/ippTools/share/addtool_find_pendingexp.sql	(revision 25161)
+++ branches/czw_branch/cleanup/ippTools/share/addtool_find_pendingexp.sql	(revision 25161)
@@ -0,0 +1,26 @@
+SELECT
+    addRun.*,
+    rawExp.exp_tag,
+    rawExp.exp_id,
+    rawExp.exp_name,
+    rawExp.camera,
+    rawExp.telescope,
+    rawExp.filelevel
+FROM addRun
+JOIN camRun
+    USING(cam_id)
+JOIN chipRun
+    USING(chip_id)
+JOIN chipProcessedImfile
+    USING(chip_id)
+JOIN rawExp
+    ON chipRun.exp_id = rawExp.exp_id
+LEFT JOIN addProcessedExp
+    USING(add_id)
+LEFT JOIN addMask
+    ON addRun.label = addMask.label
+WHERE
+    camRun.state = 'full'
+    AND ((addRun.state = 'new' AND addProcessedExp.add_id IS NULL) OR addRun.state = 'update')
+    AND addMask.label IS NULL
+
Index: branches/czw_branch/cleanup/ippTools/share/addtool_reset_faulted_runs.sql
===================================================================
--- branches/czw_branch/cleanup/ippTools/share/addtool_reset_faulted_runs.sql	(revision 25161)
+++ branches/czw_branch/cleanup/ippTools/share/addtool_reset_faulted_runs.sql	(revision 25161)
@@ -0,0 +1,8 @@
+UPDATE addRun, addProcessedExp, camRun, chipRun, rawExp
+SET addRun.state = 'new'
+WHERE
+    addRun.add_id = addProcessedExp.add_id
+    AND addRun.cam_id = camRun.cam_id
+    AND camRun.chip_id = chipRun.chip_id
+    AND chipRun.exp_id = rawExp.exp_id
+    AND addProcessedExp.fault != 0
Index: branches/czw_branch/cleanup/ippTools/share/addtool_revertprocessedexp.sql
===================================================================
--- branches/czw_branch/cleanup/ippTools/share/addtool_revertprocessedexp.sql	(revision 25161)
+++ branches/czw_branch/cleanup/ippTools/share/addtool_revertprocessedexp.sql	(revision 25161)
@@ -0,0 +1,8 @@
+DELETE FROM addProcessedExp
+USING addProcessedExp, addRun, camRun, chipRun, rawExp
+WHERE
+    addRun.add_id = addProcessedExp.add_id
+    AND addRun.cam_id = camRun.cam_id
+    AND camRun.chip_id = chipRun.chip_id
+    AND chipRun.exp_id = rawExp.exp_id
+    AND addProcessedExp.fault != 0
