alexa
Facebook
Twitter
LinkedIn
Instagram
Whatsapp
Call Now
Quick Inquiry

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

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()

89 0
7

Write a Comments


* Be the first to Make Comment

GoodFirms Badge
GoodFirms Badge

Fix Your Meeting With Our SEO Consultants in India To Grow Your Business Online