Index: trunk/ippTools/share/camtool_find_pendingexp.sql
===================================================================
--- trunk/ippTools/share/camtool_find_pendingexp.sql	(revision 14118)
+++ trunk/ippTools/share/camtool_find_pendingexp.sql	(revision 14147)
@@ -2,26 +2,28 @@
 -- does a little more work then is necessary for -addprocessed but it seems
 -- "cleaner" to use the same query for both cases 
-SELECT
-    camRun.*,
-    rawExp.exp_tag,
-    rawExp.exp_id,
-    rawExp.exp_name,
-    rawExp.camera,
-    rawExp.telescope,
-    rawExp.filelevel
-FROM camRun
-JOIN chipRun
-    USING(chip_id)
-JOIN chipProcessedImfile
-    USING(chip_id)
-JOIN rawExp
-    ON chipProcessedImfile.exp_id = rawExp.exp_id
-LEFT JOIN camProcessedExp
-    ON camRun.cam_id = camProcessedExp.cam_id
-LEFT JOIN camMask
-    ON camRun.label = camMask.label
-WHERE
-    chipRun.state = 'stop'
-    AND camRun.state = 'run'
-    AND camMask.label IS NULL
-    AND camProcessedExp.cam_id IS NULL
+SELECT * FROM
+    (SELECT
+        camRun.*,
+        rawExp.exp_tag,
+        rawExp.exp_id,
+        rawExp.exp_name,
+        rawExp.camera,
+        rawExp.telescope,
+        rawExp.filelevel
+    FROM camRun
+    JOIN chipRun
+        USING(chip_id)
+    JOIN chipProcessedImfile
+        USING(chip_id)
+    JOIN rawExp
+        ON chipProcessedImfile.exp_id = rawExp.exp_id
+    LEFT JOIN camProcessedExp
+        ON camRun.cam_id = camProcessedExp.cam_id
+    LEFT JOIN camMask
+        ON camRun.label = camMask.label
+    WHERE
+        chipRun.state = 'stop'
+        AND camRun.state = 'run'
+        AND camMask.label IS NULL
+        AND camProcessedExp.cam_id IS NULL
+    ) as Foo
