Tag : SUM()


Laravel 5 select with sum query example

We mostly required to get sum of amount, salary etc in laravel. We can also get sum of column using mysql SUM(). We have two way to get sum of column value. first we can use laravel sum() of query builder and another one we can use with directly with select statement using DB::raw(). I give you both example you can see and use any one as perfect for you. <strong>Example 1:</strong> <pre class="prettyprint lang-php"> $data = DB::table("click")->sum('numberofclick'); print_r($data); </pre> <strong>Example 2:</strong> <pre class="prettyprint lang-php"> $data = DB::table("click") ->select(DB.....

By Hardik Savani | June 8, 2016 | | 17416 Viewer | Category : Laravel
READ MORE

    Laravel - How to generate RSS Feed using roumen/feed package?

    Laravel - How to generate RSS Feed using roumen/feed package?

    Open Post

    How to integrate jQuery Fullcalendar using Bootstrap, PHP and MySQL ?

    How to integrate jQuery Fullcalendar using Bootstrap, PHP and MySQL ?

    Open Post

    Laravel 5 dynamic autocomplete search using select2 JS Ajax - Part 1

    Laravel 5 dynamic autocomplete search using select2 JS Ajax - Part 1

    Open Post

    Laravel 5 - generate PDF from html view file and download using dompdf

    Laravel 5 - generate PDF from html view file and download using dompdf

    Open Post

    AngularJS - scroll to a specific element using anchorscroll

    AngularJS - scroll to a specific element using anchorscroll

    Open Post

    How to get last record from MySQL table in Codeigniter?

    How to get last record from MySQL table in Codeigniter?

    Open Post