CREATE 
    ALGORITHM = UNDEFINED 
    DEFINER = `root`@`localhost` 
    SQL SECURITY DEFINER
VIEW `dbrecoleccion`.`contar_meses` AS
    SELECT 
        `a`.`idservicios` AS `idservicios`,
        `a`.`numromeses` AS `numromeses`,
        (SELECT 
                COUNT(`b`.`estado`)
            FROM
                `dbrecoleccion`.`cronograma_pago` `b`
            WHERE
                ((`b`.`idservicios` = `a`.`idservicios`)
                    AND (`b`.`estado` = 1))) AS `cont`
    FROM
        `dbrecoleccion`.`servicios` `a`