From 7e8165bc0faaff2ecd4357304ad41bc4386884f4 Mon Sep 17 00:00:00 2001 From: Jim Parry Date: Mon, 2 Sep 2019 21:32:50 -0700 Subject: [PATCH] Fix query builder user guide page --- user_guide_src/source/database/query_builder.rst | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/user_guide_src/source/database/query_builder.rst b/user_guide_src/source/database/query_builder.rst index ae1f9e297c2a..ede8a7b9e7a0 100755 --- a/user_guide_src/source/database/query_builder.rst +++ b/user_guide_src/source/database/query_builder.rst @@ -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()``. :: @@ -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); @@ -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 @@ -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()**