How would I use clojureql to select between two dates? Hopefully something like this:
@(-> (table :abc) (select (where (between d1 d2))))
There is no BETWEEN, and while you might be tempted to use Lisp-y multiple-argument <, that does not work either:
BETWEEN
<
;; invalid SQL output hello-cql.core> (select (table :abc) (where (< 10 :a 20))) SELECT abc.* FROM abc WHERE (10 < a < 20) ;; valid SQL output hello-cql.core> (select (table :abc) (where (and (< 10 :a) (< :a 20)))) SELECT abc.* FROM abc WHERE ((10 < a) AND (a < 20))
You can write your own between
between
(defmacro between [x min max] `(and (< ~min ~x) (< ~x ~max)))
This will be compatible with ClojureQL.
Copyright © 2021 Jogjafile Inc.
There is no
BETWEEN
, and while you might be tempted to use Lisp-y multiple-argument<
, that does not work either: