Address #332 by improving select docs
This commit is contained in:
parent
13044d7394
commit
3680a1beae
1 changed files with 8 additions and 1 deletions
|
|
@ -302,6 +302,10 @@ user=> (sql/format '{select (id, ((* cost 2)), (event status))
|
|||
["SELECT id, cost * ?, event AS status FROM table" 2]
|
||||
```
|
||||
|
||||
Here, `:select` has a three expressions as its argument. The first is
|
||||
a simple column name. The second is an expression with no alias, which
|
||||
is why it is still double-nested. The third is a simple column name and its alias.
|
||||
|
||||
With an alias on the expression:
|
||||
|
||||
```clojure
|
||||
|
|
@ -310,6 +314,10 @@ user=> (sql/format {:select [:id, [[:* :cost 2] :total], [:event :status]]
|
|||
["SELECT id, cost * ? AS total, event AS status FROM table" 2]
|
||||
```
|
||||
|
||||
Here, `:select` has a three expressions as its argument. The first is
|
||||
a simple column name. The second is an expression and its alias. The
|
||||
third is a simple column name and its alias.
|
||||
|
||||
`:select-distinct` works the same way but produces `SELECT DISTINCT`.
|
||||
|
||||
HoneySQL does not yet support `SELECT .. INTO ..`
|
||||
|
|
@ -610,7 +618,6 @@ table expression and an alias. The table expression is `[:lateral ..]`
|
|||
and the alias expression is double-nested so that it is read as a
|
||||
function call: an invocation of `:raw`.
|
||||
|
||||
|
||||
> Note: the actual formatting of a `:cross-join` clause is currently identical to the formatting of a `:select` clause.
|
||||
|
||||
## set (MySQL)
|
||||
|
|
|
|||
Loading…
Reference in a new issue