Reputation: 3416
I'm trying to build the following query in ClojureQL:
SELECT ixIso, MIN(IF(dtDespatched, fQuantity, 0)) AS quantity
FROM IsoItem WHERE fQuantity > 0
GROUP BY ixIso
HAVING quantity < 1
I've been trying variations of the following code, basing it off this IRC log I found.
(-> (cql/table DB :IsoItem)
(cql/select (cql/where (> :fQuantity 0)))
(cql/aggregate [[ "MIN(IF(IsoItem.dtDespatched, IsoItem.fQuantity, 0))" :as :quantity]]
[:ixIso] )
(cql/select (cql/where (< :quantity 1))))
However, the query it keeps giving me is:
SELECT IsoItem.ixIso,MIN(IF(IsoItem.dtDespatched, IsoItem.fQuantity, 0)) AS quantity FROM IsoItem WHERE (fQuantity > 0) AND (quantity < 1) GROUP BY IsoItem.ixIso
I feel like I must be missing something so basic.
Upvotes: 1
Views: 116
Reputation: 3416
It seems like it may have been a bug in ClojureQL itself, I've updated my project.clj to include ClojureQL 1.1.0-SNAPSHOT rather than 1.0.0 and it's corrected the issue.
Upvotes: 1