您好我在oracle上发了这个查询:
select count(*), queue
from cases
where queue not in ('OPBO_SA_Work-in-Prog','OP_AD_WIN_TECH')
group by queue
这是结果:
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
我在laravel上做同样的事情我试试这个:
'total' => $this->cases->select('queue')->whereNotIn('queue',
['OPBO_SA_Work-in-Prog','OP_AD_WIN_TECH'])->groupBy('queue')->count(),
结果是 18(只有第一个数字)
答案 0 :(得分:0)
get()而不是count():
$cases = \DB::table('cases')
->select(\DB::raw('count(*) as queue_count, queue'))
->whereNotIn('queue', ['OPBO_SA_Work-in-Prog','OP_AD_WIN_TECH'])
->groupBy('queue')
->get();