Document the correct use of the :union clause

My co-workers and I naively expected to include the :union in the
primary query, not as a container. This is a good representation, but
merits explanation.
This commit is contained in:
Donald Ball 2015-08-25 11:25:05 -04:00
parent 7001826d4b
commit ec2cd1cd29

View file

@ -174,6 +174,14 @@ Queries can be nested:
=> ["SELECT * FROM foo WHERE (foo.a IN (SELECT a FROM bar))"]
```
Queries may be united within a :union or :union-all keyword:
```clj
(sql/format {:union [(-> (select :*) (from :foo))
(-> (select :*) (from :bar))]})
=> ["(SELECT * FROM foo) UNION (SELECT * FROM bar)"]
```
Keywords that begin with `%` are interpreted as SQL function calls:
```clj