(def a (select (table db :a) (where (and (= :id 12345) (= :name "fred")))))
a
1:523 sql=> SELECT a.* FROM a WHERE ((a.id = 12345) AND (a.name = fred))
(def b (select (table db :a) (where (and (= :id 6789) (= :name "john")))))
b
1:526 sql=> SELECT a.* FROM a WHERE ((a.id = 6789) AND (a.name = john))
;as you can see these appear normal.
;However attempting some of the operations provides some strange results
(-> a (union b :all))
1:542 sql=> (SELECT a.* FROM a WHERE ((a.id = 12345) AND (a.name = fred))) UNION ALL (SELECT a.* FROM a WHERE ((a.id = 6789) AND (a.name = ?)))
(-> a (difference b :all))
1:546 sql=> (SELECT a.* FROM a WHERE ((a.id = 12345) AND (a.name = fred))) EXCEPT ALL (SELECT a.* FROM a WHERE ((a.id = 6789) AND (a.name = ?)))
; i have been wrestling with this for a few
; days now and am really unsure why this wont
; work. Any help would be appreciated.
;Thanks!
;Creating tables works as expected
(def a (select (table db :a) (where (and (= :id 12345) (= :name "fred"))))) a 1:523 sql=> SELECT a.* FROM a WHERE ((a.id = 12345) AND (a.name = fred))
(def b (select (table db :a) (where (and (= :id 6789) (= :name "john"))))) b 1:526 sql=> SELECT a.* FROM a WHERE ((a.id = 6789) AND (a.name = john))
;as you can see these appear normal. ;However attempting some of the operations provides some strange results
(-> a (union b :all)) 1:542 sql=> (SELECT a.* FROM a WHERE ((a.id = 12345) AND (a.name = fred))) UNION ALL (SELECT a.* FROM a WHERE ((a.id = 6789) AND (a.name = ?)))
(-> a (difference b :all)) 1:546 sql=> (SELECT a.* FROM a WHERE ((a.id = 12345) AND (a.name = fred))) EXCEPT ALL (SELECT a.* FROM a WHERE ((a.id = 6789) AND (a.name = ?)))
; i have been wrestling with this for a few ; days now and am really unsure why this wont ; work. Any help would be appreciated. ;Thanks!