Tuesday, February 20, 2018

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

No comments:

Post a Comment