Skip to content

Commit

Permalink
Improve Grouping headings in Active Record Querying guide [ci-skip]
Browse files Browse the repository at this point in the history
As `GROUP BY` is the actual clause and not `GROUP`, we could rename the
`Group` heading to `Group By`. But as other headings (Ordering, Selecting,
Joining) describe the usage instead of the SQL statement, it has been
renamed to it's usage: `Grouping`.

The `HAVING` condition requires a `GROUP BY` condition, so it's moved
under the `Grouping` section. The heading has been renamed similar to
other headings like `NOT conditions.
  • Loading branch information
p8 committed Jan 7, 2023
1 parent 05acc18 commit ecbaea0
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions guides/source/active_record_querying.md
Expand Up @@ -878,8 +878,8 @@ will return instead a maximum of 5 customers beginning with the 31st. The SQL lo
SELECT * FROM customers LIMIT 5 OFFSET 30
```

Group
-----
Grouping
--------

To apply a `GROUP BY` clause to the SQL fired by the finder, you can use the [`group`][] method.

Expand Down Expand Up @@ -918,8 +918,7 @@ GROUP BY status

[`count`]: https://api.rubyonrails.org/classes/ActiveRecord/Calculations.html#method-i-count

Having
------
### HAVING Conditions

SQL uses the `HAVING` clause to specify conditions on the `GROUP BY` fields. You can add the `HAVING` clause to the SQL fired by the `Model.find` by adding the [`having`][] method to the find.

Expand Down

0 comments on commit ecbaea0

Please sign in to comment.