Index: trunk/ippTools/share/dettool_toresidimfile.sql
===================================================================
--- trunk/ippTools/share/dettool_toresidimfile.sql	(revision 31910)
+++ trunk/ippTools/share/dettool_toresidimfile.sql	(revision 40535)
@@ -21,5 +21,8 @@
 FROM detRun
 JOIN detInputExp
-    USING(det_id, iteration)
+--  USING(det_id, iteration)
+    ON detInputExp.det_id = detRun.det_id
+    AND detInputExp.iteration = detRun.iteration
+--  AND detInputExp.iteration = 0
 JOIN rawExp
     ON detInputExp.exp_id = rawExp.exp_id
@@ -77,4 +80,5 @@
   ON detInputExp.det_id    = detRun.det_id
  AND detInputExp.iteration = detRun.iteration
+-- AND detInputExp.iteration = 0
 JOIN rawExp
   ON rawExp.exp_id = detInputExp.exp_id
@@ -123,4 +127,5 @@
   ON detInputExp.det_id    = detRun.det_id
  AND detInputExp.iteration = detRun.iteration
+-- AND detInputExp.iteration = 0
 JOIN rawExp
   ON rawExp.exp_id = detInputExp.exp_id
