LauJensen / clojureql

ClojureQL is superior SQL integration for Clojure
https://clojureql.sabrecms.com
Eclipse Public License 1.0
285 stars 39 forks source link

Joining on a select causes predicates errror. #70

Closed ejackson closed 13 years ago

ejackson commented 13 years ago
(-> (cql/select entities (cql/where (= :entities.entity_id 2)))
 (cql/join
 (cql/select accounts (cql/where (= :accounts.product_id 1)))
 :entity_id))

SELECT entities._,accountssubselect. FROM entities JOIN (SELECT accounts.* FROM accounts WHERE (accounts.product_id = 2)) AS accounts_subselect USING(entity_id) WHERE (entities.entity_id = 1)

Notice how the values specified for :entities.entity_id and :acocunts.product_id are switched

LauJensen commented 13 years ago

Big thanks for this one! Fixes as of https://github.com/LauJensen/clojureql/commit/8d5c056911e16294efc249212002ce36445da326 - New jar released.