久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

  1. <i id='haTwp'><tr id='haTwp'><dt id='haTwp'><q id='haTwp'><span id='haTwp'><b id='haTwp'><form id='haTwp'><ins id='haTwp'></ins><ul id='haTwp'></ul><sub id='haTwp'></sub></form><legend id='haTwp'></legend><bdo id='haTwp'><pre id='haTwp'><center id='haTwp'></center></pre></bdo></b><th id='haTwp'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='haTwp'><tfoot id='haTwp'></tfoot><dl id='haTwp'><fieldset id='haTwp'></fieldset></dl></div>
    <legend id='haTwp'><style id='haTwp'><dir id='haTwp'><q id='haTwp'></q></dir></style></legend>
  2. <tfoot id='haTwp'></tfoot>

      <bdo id='haTwp'></bdo><ul id='haTwp'></ul>

    1. <small id='haTwp'></small><noframes id='haTwp'>

      Laravel 使用 Sum 和 Groupby

      Laravel using Sum and Groupby(Laravel 使用 Sum 和 Groupby)

          <tbody id='n7gY0'></tbody>
      1. <tfoot id='n7gY0'></tfoot>

            <small id='n7gY0'></small><noframes id='n7gY0'>

                <bdo id='n7gY0'></bdo><ul id='n7gY0'></ul>
              • <legend id='n7gY0'><style id='n7gY0'><dir id='n7gY0'><q id='n7gY0'></q></dir></style></legend>
              • <i id='n7gY0'><tr id='n7gY0'><dt id='n7gY0'><q id='n7gY0'><span id='n7gY0'><b id='n7gY0'><form id='n7gY0'><ins id='n7gY0'></ins><ul id='n7gY0'></ul><sub id='n7gY0'></sub></form><legend id='n7gY0'></legend><bdo id='n7gY0'><pre id='n7gY0'><center id='n7gY0'></center></pre></bdo></b><th id='n7gY0'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='n7gY0'><tfoot id='n7gY0'></tfoot><dl id='n7gY0'><fieldset id='n7gY0'></fieldset></dl></div>

                本文介紹了Laravel 使用 Sum 和 Groupby的處理方法,對大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                問題描述

                我想獲取每個(gè)月的數(shù)量總和,以便我可以在條形圖上顯示每月的數(shù)量

                I would like to fetch sum of quantity in each month, so that I can display on bar chart quantities against month

                這就是我想的,但沒有鍛煉

                This is what I thought but didn't workout

                 $data1 = Borrow::groupBy(function($d) {
                 return Carbon::parse($d->created_at)->format('m')->sum('quantity');
                 })->get();
                

                我的表結(jié)構(gòu)

                Schema::create('borrows', function (Blueprint $table) {
                        $table->increments('id');
                        $table->integer('member_id');
                        $table->integer('book_id');
                        $table->integer('quantity');
                        $table->integer('status')->default(0);
                        $table->timestamps();
                    });
                

                推薦答案

                that a collection group by not an eloquent groupby

                that a collection group by not an eloquent groupby

                如果你想用 eloquent 來做,必須:

                if you want to do it with eloquent, gotta:

                 $data1 = Borrow::selectRaw('SUM(quantity) as qt, MONTH(created_at) as borrowMonth')
                      ->groupBy('borrowMonth')->get();
                

                如果你想用集合 groupBy 方法來做,你應(yīng)該先做 get,然后是 groupBy.

                if you want to do it with the collection groupBy method, you should first do the get, then the groupBy.

                就像,雖然我不確定你在回調(diào)中所做的事情要完成什么..

                As in, though im not sure what you're trying to accomplish with what you do inside the callback..

                 $data1 = Borrow::get()->groupBy(function($d) {
                 return Carbon::parse($d->created_at)->format('m')->sum('quantity');
                 });
                

                這篇關(guān)于Laravel 使用 Sum 和 Groupby的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

                【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!

                相關(guān)文檔推薦

                MySQLi prepared statement amp; foreach loop(MySQLi準(zhǔn)備好的語句amp;foreach 循環(huán))
                Is mysqli_insert_id() gets record from whole server or from same user?(mysqli_insert_id() 是從整個(gè)服務(wù)器還是從同一用戶獲取記錄?)
                PHP MySQLi doesn#39;t recognize login info(PHP MySQLi 無法識別登錄信息)
                mysqli_select_db() expects exactly 2 parameters(mysqli_select_db() 需要 2 個(gè)參數(shù))
                Php mysql pdo query: fill up variable with query result(Php mysql pdo 查詢:用查詢結(jié)果填充變量)
                MySQLI 28000/1045 Access denied for user #39;root#39;@#39;localhost#39;(MySQLI 28000/1045 用戶“root@“l(fā)ocalhost的訪問被拒絕)

                  • <tfoot id='xOazN'></tfoot>
                    <i id='xOazN'><tr id='xOazN'><dt id='xOazN'><q id='xOazN'><span id='xOazN'><b id='xOazN'><form id='xOazN'><ins id='xOazN'></ins><ul id='xOazN'></ul><sub id='xOazN'></sub></form><legend id='xOazN'></legend><bdo id='xOazN'><pre id='xOazN'><center id='xOazN'></center></pre></bdo></b><th id='xOazN'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='xOazN'><tfoot id='xOazN'></tfoot><dl id='xOazN'><fieldset id='xOazN'></fieldset></dl></div>

                    <legend id='xOazN'><style id='xOazN'><dir id='xOazN'><q id='xOazN'></q></dir></style></legend>
                      <tbody id='xOazN'></tbody>

                      <small id='xOazN'></small><noframes id='xOazN'>

                        <bdo id='xOazN'></bdo><ul id='xOazN'></ul>

                          主站蜘蛛池模板: 国产乱一区二区三区视频 | 黄色毛片视频 | 成人精品一区二区三区中文字幕 | 看a网站| av影音资源 | 色在线视频网站 | 高清人人天天夜夜曰狠狠狠狠 | 99精品99久久久久久宅男 | 国产一区二区三区视频 | 无码一区二区三区视频 | 99精品国产成人一区二区 | 久久爱一区 | 丁香婷婷久久久综合精品国产 | www.亚洲精品| 蜜桃av一区二区三区 | 国产视频二区在线观看 | 福利视频1000 | 亚洲激情网站 | 天天久久| 久久av一区二区 | 亚洲成人av一区二区 | 欧美综合在线视频 | 久久久久久综合 | 91视频国产一区 | 久久久久黄色 | www四虎影视 | 在线观看免费黄色片 | 亚洲一区| 一级毛片免费完整视频 | 成人欧美一区二区三区在线播放 | 国产一区二区在线免费观看 | 狠狠的操| 久久精品视频一区二区 | 日韩1区2区| 午夜资源 | 欧美lesbianxxxxhd视频社区 | 国产欧美精品一区二区三区 | 一区二区三区精品视频 | 欧美黑人又粗大 | 精品一区二区三区入口 | 成人高清在线 |