Skip to content

Commit

Permalink
Adding docs for random order. Fixes #863 (#1016)
Browse files Browse the repository at this point in the history
  • Loading branch information
jwoertink authored Jun 4, 2022
1 parent e9d9297 commit 43d5791
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/actions/guides/database/querying.cr
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,19 @@ class Guides::Database::Querying < GuideAction
UserQuery.new.age.desc_order(:nulls_last)
```
### Random Order
Return rows in a random order.
`SELECT COLUMNS FROM users ORDER BY RANDOM()`
```crystal
UserQuery.new.random_order
```
> Appending a specific order after a random order will use that specific order.
> (e.g. `UserQuery.new.random_order.username.desc_order` will order by username descending)
## Group By
Return rows grouped by the `age` column.
Expand Down

0 comments on commit 43d5791

Please sign in to comment.