2
Good morning,
Estos trying to make a select to select only the attendants who have the number of calls below the media.
It seems simple, but I’m not succeeding, I’ve tried many ways...
Do not have to count the number of calls in the WHERE put something like "Count(*) < $media"
Thank you.
$media = '40';
SELECT a.adminID
from os
JOIN cadastroCliente cc ON cc.cadastroClienteID = os.idcliente
JOIN administrador a ON a.adminID = os.idusuario
WHERE os.idusuario = a.adminID
AND os.status = '1'
AND os.respondido = '0'
ORDER BY RAND()
LIMIT 1
Why not do the count first, and give a Return $Row[count]; and in the next SQL do a new query with Count..
– Sr. André Baill