Level 1
i think you can try using something like that expressions
->select(DB::raw('count(*) as user_count, status'))
in your query builder to get the desired results
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
How to make this query with QueryBuilder or what?
SELECT duznici_2018.*,sum(rate_2018.rata) as ukupno FROM duznici_2018 LEFT JOIN rate_2018 ON duznici_2018.duznikID=rate_2018.duznikID GROUP BY duznikID DESC
I'm stuck on how to add SUM:
$sumrate = DB::table('duznicis')->leftJoin('rates', 'duznicis.kupac_id', '=', 'rates.duznik_id')->get();
Please or to participate in this conversation.