Index: /trunk/ippTools/src/dettool.c
===================================================================
--- /trunk/ippTools/src/dettool.c	(revision 9406)
+++ /trunk/ippTools/src/dettool.c	(revision 9407)
@@ -4069,6 +4069,16 @@
         "   AND detInputExp.exp_tag = detResidExp.exp_tag"
         " WHERE"
-        "   detRun.state = 'run'"
-        " GROUP BY"
+        "   detRun.state = 'run'");
+    
+    // XXX this query was not restricted by det_id, resulting 
+    // in an inconsistent UPDATE below.  I added this AND clause
+    // though there may be a cleaner method (EAM 2006.10.08)
+    psStringAppend (
+	&query,
+	"  AND detRun.position = '%s'", det_id);
+
+    psStringAppend (
+	&query, 
+	" GROUP BY"
         "   detRun.position,"
         "   detRun.iteration,"
@@ -4096,5 +4106,5 @@
         return true;
     }
-
+    
     // start a transaction so we don't end up with an incremented iteration
     // count but no detInputExps
