jeudi 26 septembre 2019

How to select min and max in laravel

I want to convert this code in laravel.

SELECT MAX(date_start) AS DateStart,MIN(date_end) AS DateEnd FROM DBTest

And I try this code

$data = DB::table('DBTest')
    ->select(max('date_start'), min('date_end')))
    ->get();

Return Error: max(): When only one parameter is given, it must be an array

I am using laravel 5.2, and SQLyog as database

I am confuse in syntax please help me



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2mPTcKB
via IFTTT

Aucun commentaire:

Enregistrer un commentaire