Index: /trunk/ippTools/src/addtool.c
===================================================================
--- /trunk/ippTools/src/addtool.c	(revision 32450)
+++ /trunk/ippTools/src/addtool.c	(revision 32451)
@@ -280,4 +280,18 @@
 
     }
+
+    //if we grab a group of camRun/stackRuns that have multiple camRun/stackRun pointing to the same exp_id/stack_id, and that exp_id/stack_id has never before been added to addRun, we need to group by exp_id/stack_id to ensure that only 1 of the camRun/stackRun for that exp_id is added to the addRun stage.
+
+    if (strcmp(stage,"cam") == 0) {
+        psStringAppend(&query, " GROUP BY exp_id"); 
+   }
+      if (strcmp(stage,"stack") == 0) {
+	psStringAppend(&query, " GROUP BY stack_id");
+      }
+    if (strcmp(stage,"staticsky") == 0) {
+	psStringAppend(&query, " GROUP BY stack_id");
+      }
+
+
 
     psTrace("addtool.c", PS_LOG_INFO,"query: \n\n%s\n\n",query);
