Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix query builder user guide page #2180

Merged
merged 1 commit into from
Sep 3, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions user_guide_src/source/database/query_builder.rst
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ selectMax(), You can optionally include a second parameter to rename
the resulting field.

.. note:: This method is particularly helpful when used with ``groupBy()``. For
counting results generally see ``countAll()`` or ``countAllResults()``.
counting results generally see ``countAll()`` or ``countAllResults()``.

::

Expand Down Expand Up @@ -297,7 +297,8 @@ methods:

#. **Subqueries:**
You can use an anonymous function to create a subquery.
::

::

$builder->where('advance_amount <', function(BaseBuilder $builder) {
return $builder->select('MAX(advance_amount)', false)->from('orders')->where('id >', 2);
Expand All @@ -307,7 +308,9 @@ methods:
**$builder->orWhere()**

This function is identical to the one above, except that multiple
instances are joined by OR::
instances are joined by OR

::

$builder->where('name !=', $name);
$builder->orWhere('id >', $id); // Produces: WHERE name != 'Joe' OR id > 50
Expand All @@ -330,7 +333,6 @@ You can use subqueries instead of an array of values.
$builder->whereIn('id', function(BaseBuilder $builder) {
return $builder->select('job_id')->from('users_jobs')->where('user_id', 3);
});

// Produces: WHERE "id" IN (SELECT "job_id" FROM "users_jobs" WHERE "user_id" = 3)

**$builder->orWhereIn()**
Expand Down