dimanche 11 février 2018

Finding Sum of total collection

My database structure like :

collected today  created_at              updated_at
200              2017-07-02 06:20:07     2017-07-02 06:34:19
200              2017-07-02 06:34:19     2017-07-02 06:34:19
400              2017-07-03 06:34:19     2017-07-03 06:34:19
100              2017-07-05 06:34:19     2017-07-05 06:34:19
50               2017-07-02 06:34:19     2017-07-02 06:34:19

I wanted to find sum of every date, i used following query to access the data. But it returns 0 though i have value in database in every date. What could be possible Error of the following query?

  $monthly_report = DB::table('transactions')
            ->groupBy(DB::raw('Date(transactions.updated_at)'))
            ->sum('transactions.collected_today');



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire