Advertisement

TrimwebsolutionsTrimwebsolutions

Problem and Solutions

How do I get distinct values from the table along with the count of how many rows there are containing that value in laravel

By M.K. Verma · 2 May 2022

How do I get distinct values from the table along with the count of how many rows there are containing that value in laravel

Try This 

Model::query()->groupBy('country_name')->select('counrty_name',DB::raw('COUNT(1)'))->get()