anchor.diff:                                                   :on (and (= result.v-name version.i-name) (= v-version version)))
                                              (and (in m-name ',host)
                                                   ,(if only-release
  -                                                     `(= ,only-release (sbcl_release_for_version version))
  +                                                     `(= ,only-release version.belongs-to-release)
                                                        t)))
                                       (version.i-name)))))
          :tuple 0)
  
positive.code:                                                      (order-by
                                                        (join
                                                         ;; find out number of sub-revisions for every release;
                                                         ;; be careful, sbcl-release-for-version isn't very robust.
                                                         (alias
                                                          (select ((as (count *) n-revisions) (as (sbcl_release_for_version ver.version) release))
                                                                  (having
                                                                   (group-by (where (as version ver)
                                                                                    (in (sbcl_release_for_version ver.version)
                                                                                        (distinct
                                                                                         (select (version)
                                                                                                 (where (join version result
                                                                                                              :on (and (= v-version version)
                                                                                                                       (= v-name i-name)))
                                                                                                        is-release)))))
                                                                             ((sbcl_release_for_version ver.version)))
                                                                   (> (count *) 1)))
                                                          releasecount)
                                                         (alias
  
negative.code: (defun emit-where-clause (&key benchmark implementations only-release host earliest latest &allow-other-keys)
    `(where
      (join (join (as result r)
                  (as build b)
                  :on (and (= r.v-name b.v-name) (= r.v-version b.v-version) (= r.mode b.mode)))
            (as version v)
            :on (and (= r.v-name v.i-name) (= r.v-version v.version)))
      (and (= r.b-name ,benchmark)
           ,(if only-release
                `(= ,only-release v.belongs-to-release)
                `(or (= v.belongs-to-release v.version)
                     (>= v.release-date ,latest)))
           (in m-name ',host)
           (in b.v-name ',(mapcar #'implementation-spec-impl implementations))
           (in b.mode ',(mapcar #'implementation-spec-mode implementations)))))
  
  
  
  