Tag : MySQL Subquery


Laravel - How to make subquery in select statement?

Sometimes we require to make subquery inside the select statement in Laravel. At that time we are thinking how to select from subquery using in Laravel Query Builder. In this post i will give you example of subquery in select statement in Laravel 5 application from scratch. For subquery in select statement we are going to use <strong class="path">DB::raw()</strong>. DB raw function through we can simply make suquery join in Laravel Eloquent Query Builder. Here as bellow full example, i have three tables as listed bellow: <strong>1)products</strong> <strong>2)products_stock</strong> <strong.....

By Hardik Savani | February 6, 2017 | | 13662 Viewer | Category : Laravel MySql
READ MORE

Laravel 5 Join with subquery in Query Builder Example

In this post i want to show you how to use subquery with join in laravel query builder. Whenever you need to use subquery in your laravel project you can use following example and learn hot to use subquery. In bellow example you can see we add subquery using DB::raw(), DB::raw() throught we can select our subtable and after in second argument i added compare your field. That way you can easily fire subquery with laravel 5.2 query builder. <strong>Example:</strong> <pre class="language-sql"> $data = DB::table("items") ->select("items.*","items_count.price_group","items_count.quantity_group") .....

By Hardik Savani | March 2, 2016 | | 28230 Viewer | Category : PHP Laravel
READ MORE

    How to get keys name from array using array helper in PHP Laravel ?

    How to get keys name from array using array helper in PHP Laravel ?

    Open Post

    AngularJS - How to create read more/less toggle using Directive?

    AngularJS - How to create read more/less toggle using Directive?

    Open Post

    Laravel 5 Ajax CRUD with Pagination example and demo from scratch

    Laravel 5 Ajax CRUD with Pagination example and demo from scratch

    Open Post

    Laravel 5.4 - send email using Markdown Mailables

    Laravel 5.4 - send email using Markdown Mailables

    Open Post

    How to install composer using command line in ubuntu ?

    How to install composer using command line in ubuntu ?

    Open Post

    Laravel 5 create custom artisan command with example

    Laravel 5 create custom artisan command with example

    Open Post