count with group on eloquent laravel - development

count with group on eloquent laravel

Hi i have make this query on oracle:

select count(*), queue
from cases
where queue not in ('OPBO_SA_Work-in-Prog','OP_AD_WIN_TECH')
group by queue

this is the result:

18  OP_AD_WIN_ACTIVATION
18  OP_AD_WIN_HARDWARE
4   OP_AD_WIN_FIBER
37  OPBO_WIN_Fiber_pend_i
8   OP_AD_WIN_RELOCATION
47  OPBO_WIN_Act_pend_i

i wana make the same on laravel i try this:

  'total' => $this->cases->select('queue')->whereNotIn('queue',
['OPBO_SA_Work-in-Prog','OP_AD_WIN_TECH'])->groupBy('queue')->count(),

the result is
18 ( only the first number )



from Laravel Questions and Answers https://laravelquestions.com/laravel/count-with-group-on-eloquent-laravel/
via Lzo Media

Comments

Popular posts from this blog

How can I solve "laravel/horizon v1.1.0 requires ext-pcntl * -> the requested PHP extension pcntl is missing from your system"? - development

Using PHP and MySQL data to generate PDF letters like in MS Word mailmerge functionality - development

CORS issue between web/android/ios