2

I just worked this one out. Since it's not in the documentation and needs you to dig into the source, this seemed the right venue for the solution.

In ClojureQL, how do you create a query like:

SELECT * from foo where id in (1, 5, 7);
Jim Downing
  • 1,481
  • 12
  • 29

1 Answers1

3

You need to use the in predicate from the predicates namespace, e.g.

(require '[clojureql.core :as ql])
(require '[clojureql.predicates :as pred])
(ql/select (ql/table :foo) (ql/where (pred/in :id [1 5 7])))
Jim Downing
  • 1,481
  • 12
  • 29
  • 2
    Having to reference the predicate namespace is a bug in ClojureQL 1.0.1, see https://github.com/LauJensen/clojureql/issues/100 – NielsK Dec 02 '11 at 10:42