Merge pull request #89 from dball/document-unions
Document the correct use of the :union clause
This commit is contained in:
commit
ee2b778d52
1 changed files with 8 additions and 0 deletions
|
|
@ -174,6 +174,14 @@ Queries can be nested:
|
||||||
=> ["SELECT * FROM foo WHERE (foo.a IN (SELECT a FROM bar))"]
|
=> ["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:
|
Keywords that begin with `%` are interpreted as SQL function calls:
|
||||||
|
|
||||||
```clj
|
```clj
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue