DROP PROCEDURE  IF EXISTS uspGetHaziFeladatCsatolmanyokOsszMeret 
GO

CREATE PROCEDURE uspGetHaziFeladatCsatolmanyokOsszMeret
   @pTanevId INT
  ,@pTanarId INT
AS
BEGIN
  SET NOCOUNT ON;

  SELECT ISNULL(SUM(CAST(cs.C_FILESIZEBYTE AS BIGINT)), 0)
  FROM T_DKT_FELADAT_OSSZES hf
  INNER JOIN T_DKT_FELADATFILE_OSSZES hfcs ON hfcs.C_FELADATID = hf.ID
    AND hfcs.TOROLT = 'F'
  INNER JOIN T_DKT_FILE_OSSZES cs ON cs.ID = hfcs.C_FILEID
    AND cs.TOROLT = 'F'
  WHERE hf.C_ALKALMAZOTTID = @pTanarId
    AND hf.C_FELADATTIPUSID = 0
    AND hf.C_TANEVID = @pTanevId
    AND hf.TOROLT = 'F'
END
GO


