How to fetch maximum and minimum value of a column in laravel

In this example, I have a user’s table & I want to get the user who have maximum and minimum amount. For that I used the following code.

$price = DB::table('users')->max('amount');
$price = DB::table('users')->min('amount');

– For complete Blog, Visit FindNerd Forum Link: How to fetch maximum and minimum value of a column in laravel .

FindNerd is the right place to resolve PHP language problems. Here you can post PHP Questions and Answers.

If you need  PHP language, visit to FindNerd’sPHP Blog.

Advertisements
How to fetch maximum and minimum value of a column in laravel

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s