Level 39
$lrgtimes = \DB::select("SELECT h_name,MAX(calc_mem) FROM HDatas WHERE created_at > $timeperiod GROUP BY h_name HAVING MAX(calc_mem)>0.9");
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hello,
I would like further develop this query by, selecting only distinct/groupby?? "h_name" and only getting the max calc_mem, whereDate('created_at', '>', $timeperiod), and having('calc_mem', '>', 0.9).
$lrgtimes = HDatas::select(DB::raw('calc_mem, h_name, alloc_lim, mem_peak, created_at'))
->whereDate('created_at', '>', $timeperiod)
->having('calc_mem', '>', 0.9)
->get();
how is it possible?
Please or to participate in this conversation.