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



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire