Index: trunk/ippTools/src/remotetool.c
===================================================================
--- trunk/ippTools/src/remotetool.c	(revision 36914)
+++ trunk/ippTools/src/remotetool.c	(revision 36968)
@@ -94,4 +94,5 @@
 
   // Get a list of the things we can insert into a new component
+  // CZW: these labels no longer need to be linked to the table, as I've split stageRun and remoteRun into sub-queries.
   psString query = NULL;
   psString whereOption = psStringCopy("");
@@ -104,5 +105,5 @@
     
     if (label) {
-      psStringAppend(&query, " AND (chipRun.label = '%s')", label);
+      psStringAppend(&whereOption, "\n AND (label = '%s')", label);
     }
   }
@@ -115,5 +116,5 @@
     
     if (label) {
-      psStringAppend(&query, " AND (camRun.label = '%s')", label);
+      psStringAppend(&whereOption, "\n AND (label = '%s')", label);
     }
   }    
@@ -128,5 +129,5 @@
       // Because warp has to check to see if something other than the state is set correctly, I have to use this wonky way to pass the label in.
       //      psStringAppend(&query, " AND (warpRun.label = '%s')", label);
-      psStringAppend(&whereOption, "\n AND (warpRun.label = '%s')", label);
+      psStringAppend(&whereOption, "\n AND (label = '%s')", label);
     }
   }    
@@ -139,5 +140,5 @@
     
     if (label) {
-      psStringAppend(&query, " AND (stackRun.label = '%s')", label);
+      psStringAppend(&whereOption, "\n AND (label = '%s')", label);
     }
   }    
@@ -152,5 +153,5 @@
     psFree(limitString);
   }
-  if (!p_psDBRunQueryF(config->dbh, query,whereOption)) {
+  if (!p_psDBRunQueryF(config->dbh, query,whereOption,whereOption)) { // This needs to be here twice because we need to restrict on label twice.
     psError(PS_ERR_UNKNOWN, false, "database error");
     psFree(query);
