Index: trunk/ippTools/share/Makefile.am
===================================================================
--- trunk/ippTools/share/Makefile.am	(revision 28322)
+++ trunk/ippTools/share/Makefile.am	(revision 28339)
@@ -18,7 +18,8 @@
      addtool_revertminidvodbprocessed.sql \
      addtool_revertprocessedexp.sql \
+     camtool_addprocessedexp.sql \
      camtool_donecleanup.sql \
      camtool_find_chip_id.sql \
-     camtool_find_pendingexp.sql \
+     camtool_pendingexp.sql \
      camtool_find_pendingimfile.sql \
      camtool_find_processedexp.sql \
Index: trunk/ippTools/share/camtool_find_pendingexp.sql
===================================================================
--- trunk/ippTools/share/camtool_find_pendingexp.sql	(revision 28322)
+++ 	(revision )
@@ -1,26 +1,0 @@
--- this query is used by both camtool -pendingexp & camtool -addprocessedexp it
--- 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,
-    chipRun.magicked AS chip_magicked,
-    camProcessedExp.path_base
-FROM camRun
-JOIN chipRun
-    USING(chip_id)
-JOIN rawExp
-    USING(exp_id)
-LEFT JOIN camProcessedExp
-    USING(cam_id)
-LEFT JOIN camMask
-    ON camRun.label = camMask.label
-WHERE
-    chipRun.state = 'full'
-    AND ((camRun.state = 'new' AND camProcessedExp.cam_id IS NULL) OR camRun.state = 'update')
-    AND camMask.label IS NULL
Index: trunk/ippTools/share/camtool_pendingexp.sql
===================================================================
--- trunk/ippTools/share/camtool_pendingexp.sql	(revision 28339)
+++ trunk/ippTools/share/camtool_pendingexp.sql	(revision 28339)
@@ -0,0 +1,27 @@
+SELECT
+    camRun.*,
+    rawExp.exp_tag,
+    rawExp.exp_id,
+    rawExp.exp_name,
+    rawExp.camera,
+    rawExp.telescope,
+    rawExp.filelevel,
+    chipRun.magicked AS chip_magicked,
+    camProcessedExp.path_base,
+    IFNULL(Label.priority, 10000) AS priority
+FROM camRun
+JOIN chipRun
+    USING(chip_id)
+JOIN rawExp
+    USING(exp_id)
+LEFT JOIN camProcessedExp
+    USING(cam_id)
+LEFT JOIN camMask
+    ON camRun.label = camMask.label
+LEFT JOIN Label
+    ON camRun.label = Label.label
+WHERE
+    chipRun.state = 'full'
+    AND ((camRun.state = 'new' AND camProcessedExp.cam_id IS NULL) OR camRun.state = 'update')
+    AND camMask.label IS NULL
+    AND (Label.active OR Label.active IS NULL)
