Queue has taken calls

I have asterisk queue and queue log to mysql. How to count agent taken calls (rasterisk -x ‘queue show …’) from mysql query.

Query select * from queuelog where time like ‘2017-06-30%’ and agent=‘agent’ and event='connect’
doesn’t operate to all agents. (some agents taken calls matches, some not)

for example:
root@callcenter:/var/log/asterisk# rasterisk -x 'queue show callcenter’
callcenter has 1 calls (max unlimited) in ‘fewestcalls’ strategy (6s holdtime, 123s talktime), W:0, C:186, A:22, SL:91.9% within 30s
agent1 (sip/429 from sip/429) (ringinuse disabled) (dynamic) (in call) (Busy) has taken 36 calls (last was 2683 secs ago)
agent2 (sip/427 from sip/427) (ringinuse disabled) (dynamic) (Not in use) has taken 26 calls (last was 618 secs ago)

mysql> select agent,count() from queuelog where time like ‘2017-06-30%’ and event=‘connect’ group by agent;
| agent | count(
) |
| agent1 | 36 |
| agent2 | 49 |

taken calls not mathes because agent REMOVEMEMBER and ADDMEMBER