Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

laravel join with count

Try something like this

DB::table('website_tags')
->join('assigned_tags', 'website_tags.id', '=', 'assigned_tags.tag_id')
->select('website_tags.id as id', 'website_tags.title as title', DB::raw("count(assigned_tags.tag_id) as count"))
->groupBy('website_tags.id')
->get();
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #laravel #join #count
ADD COMMENT
Topic
Name
7+4 =