clear markdown compare help donate or buy diddy dollings comments/suggestions/bugs a leap of faith? bible365
clear markdown donate comments/suggestions/bugs a leap of faith? bible365 diddy dollings
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0. 818564 fiddles created (9202 in the last week).

CREATE TABLE dbClientes (`id` int, `Nombre` varchar(6)) ;
 hidden batch(es)


INSERT INTO dbClientes (`id`, `Nombre`) VALUES (1, 'Juan'), (2, 'Victor'), (3, 'Arturo') ;
 hidden batch(es)


CREATE TABLE syUsers (`id` int, `Nombre` varchar(12)) ;
 hidden batch(es)


INSERT INTO syUsers (`id`, `Nombre`) VALUES (1, 'Contabilidad'), (2, 'JuankGlezz') ;
 hidden batch(es)


CREATE TABLE syUsers_WebAccess (`id` int, `idUser` int, `idCliente` int) ;
 hidden batch(es)


INSERT INTO syUsers_WebAccess (`id`, `idUser`, `idCliente`) VALUES (1, 1, 1), (2, 1, 3), (3, 2, 1) ;
 hidden batch(es)


SELECT C.Nombre, C.id, SUM(IF(ISNULL(NC.id), 0, 1)) AS NumCuentas FROM dbClientes C LEFT JOIN syUsers_WebAccess AS NC ON NC.idCliente = C.id WHERE C.id NOT IN (SELECT idCliente FROM syUsers_WebAccess WHERE idUser = 2) GROUP BY C.id ;
Nombre id NumCuentas
Victor 2 0
Arturo 3 1
 hidden batch(es)