Ver Mensaje Individual
  #2 (permalink)  
Antiguo 15/11/2005, 08:25
Avatar de Andres95
Andres95
Colaborador
 
Fecha de Ingreso: diciembre-2004
Mensajes: 1.802
Antigüedad: 19 años, 5 meses
Puntos: 38
si es sql server podrias hacer un sp como sigue:

Código:
CREATE PROCEDURE spCuentaVerificaciones
@Id_Empresa int
AS

Declare @Cuenta int

set @cuenta = 0



SELECT 
          @cuenta = COUNT(*) 
FROM 
          verificaciones 
WHERE 
          verificaciones.id_empresa=@Id_Empresa

Set @cuenta = isnull(@cuenta,0)

SELECT 
          @cuenta = @cuenta + COUNT(*) 
FROM 
          verificaciones_ko 
WHERE 
          verificaciones_ko.id_empresa=@Id_Empresa

return isnull(@cuenta,0)