﻿DROP PROCEDURE IF EXISTS uspTanuloMulasztasParhuzamosOra
GO

CREATE PROCEDURE dbo.uspTanuloMulasztasParhuzamosOra 
   @pTanoraId int
  ,@pIdoszakKezdete datetime
  ,@pIdoszakVege datetime
AS
BEGIN
SET NOCOUNT ON;
  DECLARE  @hianyzasTipus int=1500
      ,@kesesTipus int =1499
  SELECT 
    tm.C_ORATANULOIID TanuloId
    FROM T_TANULOMULASZTAS tm
    INNER JOIN T_TANITASIORA tao WITH (NOLOCK) ON tm.C_TANITASIORAKID = tao.ID
  WHERE @pIdoszakVege > tao.C_ORAKEZDETE AND @pIdoszakKezdete < tao.C_ORAVEGE
          AND tm.C_TIPUS BETWEEN @kesesTipus AND @hianyzasTipus
      AND tao.ID <> @pTanoraid
END
GO