Index: trunk/ippTools/src/dettool.c
===================================================================
--- trunk/ippTools/src/dettool.c	(revision 9409)
+++ trunk/ippTools/src/dettool.c	(revision 9413)
@@ -1429,14 +1429,8 @@
         " FROM detProcessedImfile"
         " JOIN detRun"
-        "   ON detProcessedImfile.det_id = detRun.position"
+        "   ON detRun.position = detProcessedImfile.det_id"
         " WHERE"
         "   detRun.state = 'run'"
     );
-
-    // XXX need to add:
-    // JOIN detResidExp ON detResidExp.iteration = iteration - 1
-    // AND detResidExp.exp_tag = detProcessedImfile.exp_tag
-    // XXX and to WHERE:
-    // AND detResidExp.accept = 1
 
     if (config->where) {
