Hei there, I'm new in laravel and I have some issues with laravel query builder. The query I would like to build is this one:
Select nofaktur, date, diskon, namacust, SUM(subtotal)+SUM(diskon)) as
subtot, SUM(diskon) as totaldiskon, total From crLap GROUP BY nofaktur Order
By date, nofaktur.
i've tried like this
$penjualan = DB::table('report_penjualan')
->select('nofaktur',
DB::raw('(SUM(subtotal)+SUM(diskon)) as subtot'),
DB::raw('SUM(diskon) as totaldiskon'))
->groupBy('nofaktur')
->get()->toArray();
but the field 'date', 'diskon' etc can't be shown..