Skip to content
Advertisement

Laravel Distinct Count

Any way to make this query work using laravel? DB::raw or Eloquent usage doesn’t matter.

JavaScript

Here’s what i’ve tried but cannot get the proper output:

JavaScript

This returns something like this and i’d like to fix that:

JavaScript

I just want to get count 15.

Advertisement

Answer

you can simply replace get with count in this way:

JavaScript

also can do:

JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement