Index: trunk/ippTools/share/camtool_find_pendingimfile.sql
===================================================================
--- trunk/ippTools/share/camtool_find_pendingimfile.sql	(revision 19972)
+++ trunk/ippTools/share/camtool_find_pendingimfile.sql	(revision 23617)
@@ -1,25 +1,20 @@
-SELECT DISTINCT * FROM
-     -- the subselect is so where criteria can be specified without knowing
-     -- which table the field came from
-    (SELECT
-        camRun.cam_id,
-        chipProcessedImfile.*,
-        rawExp.exp_name,
-        rawExp.camera,
-        rawExp.telescope,
-        rawExp.filelevel
-    FROM camRun
-    JOIN chipRun
---      ON camRun.chip_id = chipRun.chip_id
-        USING (chip_id)
-    JOIN chipProcessedImfile
---      ON camRun.chip_id = chipProcessedImfile.chip_id
-        USING (chip_id)
-    JOIN rawExp
-      ON chipProcessedImfile.exp_id = rawExp.exp_id
-    LEFT JOIN camProcessedExp
-        USING(cam_id)
-    LEFT JOIN camMask
-        ON camRun.label = camMask.label
-    WHERE
-        camMask.label IS NULL) as foo
+SELECT
+    camRun.cam_id,
+    chipProcessedImfile.*,
+    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
+    USING(cam_id)
+LEFT JOIN camMask
+    ON camRun.label = camMask.label
+WHERE
+    camMask.label IS NULL
