Index: /trunk/ippTools/src/dettool.c
===================================================================
--- /trunk/ippTools/src/dettool.c	(revision 9407)
+++ /trunk/ippTools/src/dettool.c	(revision 9408)
@@ -2679,4 +2679,11 @@
 
     if (config->where) {
+	// XXX need to replace det_id with detNormalizedImfile.det_id
+	bool status;
+	int iteration = psMetadataLookupS32 (&status, config->where, "iteration");
+	if (status) {
+	    psMetadataRemoveKey (config->where, "iteration");
+	    psMetadataAddS32 (config->where, PS_LIST_TAIL, "detNormalizedImfile.iteration", 0, "==", iteration);
+	}
         psString whereClause = psDBGenerateWhereConditionSQL(config->where, NULL);
         psStringAppend(&query, " AND %s", whereClause);
