Index: trunk/ippTools/src/detselect.c
===================================================================
--- trunk/ippTools/src/detselect.c	(revision 15856)
+++ trunk/ippTools/src/detselect.c	(revision 15857)
@@ -189,8 +189,11 @@
     }
 
-    // XXX this needs to be more controlled: we should specifically choose the
-    // single detrend image which matches all criteria and has the latest
+    // we choose the single detrend image which matches all criteria and has the latest
     // insertion date
-    psStringAppend(&query, " ORDER BY registered DESC LIMIT 1");
+
+    // unless explicitly specified by the user, list all possible matches
+    if (!psMetadataLookupBool(NULL, config->args, "-unlimit")) {
+	psStringAppend(&query, " ORDER BY registered DESC LIMIT 1");
+    }
 
     if (!p_psDBRunQuery(config->dbh, query)) {
Index: trunk/ippTools/src/detselectConfig.c
===================================================================
--- trunk/ippTools/src/detselectConfig.c	(revision 15856)
+++ trunk/ippTools/src/detselectConfig.c	(revision 15857)
@@ -66,4 +66,6 @@
     psMetadataAddBool(searchArgs, PS_LIST_TAIL, "-simple",  0,
             "use the simple output format", false);
+    psMetadataAddBool(searchArgs, PS_LIST_TAIL, "-unlimit",  0,
+            "list all possible detruns, not just the best match", false);
  
     // -select
