(-> (sq/select (sq/join (sq/table db :tableA)(sq/table db :tableB)(sq/where (= :tableA.id 27219)))
(sq/where (= :tableA.group_id 27202)))
(sq/union (sq/select (sq/join (sq/table db :tableA)(sq/table db :tableB)(sq/where (= :tableA.id 27391)))
(sq/where (= :tableA.group_id 27353))) :all))
The sql that it generates:
(SELECT tableA.,tableB. FROM tableA JOIN tableB ON (tableA.id = 27219) WHERE (tableA.groupid = 27202)) UNION ALL (SELECT tableA.,tableB._ FROM tableA JOIN tableB ON (tableA.id = 27391) WHERE (tableA.group_id = ?))
The sql that it should generate:
(SELECT tableA.,tableB. FROM tableA JOIN tableB ON (tableA.id = 27219) WHERE (tableA.groupid = 27202)) UNION ALL (SELECT tableA.,tableB._ FROM tableA JOIN tableB ON (tableA.id = 27391) WHERE (tableA.group_id = 27353))
Here's a bit more information. If there's no join in the query, the generated sql is correct:
(-> (sq/select (sq/table db :tableA) (sq/where (= :tableA.id 27219)))
(sq/union (sq/select (sq/table db :tableA) (sq/where (= :tableA.group_id 27353))) :all))
(SELECT tableA.* FROM tableA WHERE (tableA.id = 27219)) UNION ALL (SELECT tableA.* FROM tableA WHERE (tableA.group_id = 27353))
The following query doesn't generate correct sql:
(-> (sq/select (sq/join (sq/table db :tableA)(sq/table db :tableB)(sq/where (= :tableA.id 27219))) (sq/where (= :tableA.group_id 27202))) (sq/union (sq/select (sq/join (sq/table db :tableA)(sq/table db :tableB)(sq/where (= :tableA.id 27391))) (sq/where (= :tableA.group_id 27353))) :all))
The sql that it generates: (SELECT tableA.,tableB. FROM tableA JOIN tableB ON (tableA.id = 27219) WHERE (tableA.groupid = 27202)) UNION ALL (SELECT tableA.,tableB._ FROM tableA JOIN tableB ON (tableA.id = 27391) WHERE (tableA.group_id = ?))
The sql that it should generate: (SELECT tableA.,tableB. FROM tableA JOIN tableB ON (tableA.id = 27219) WHERE (tableA.groupid = 27202)) UNION ALL (SELECT tableA.,tableB._ FROM tableA JOIN tableB ON (tableA.id = 27391) WHERE (tableA.group_id = 27353))
Here's a bit more information. If there's no join in the query, the generated sql is correct:
(-> (sq/select (sq/table db :tableA) (sq/where (= :tableA.id 27219))) (sq/union (sq/select (sq/table db :tableA) (sq/where (= :tableA.group_id 27353))) :all))
(SELECT tableA.* FROM tableA WHERE (tableA.id = 27219)) UNION ALL (SELECT tableA.* FROM tableA WHERE (tableA.group_id = 27353))