DROP PROCEDURE IF EXISTS [dbo].[uspGetTanitasiOraTulajdonsag]
GO

CREATE PROCEDURE [dbo].[uspGetTanitasiOraTulajdonsag]
   @pTanitasiOraId int
  ,@pTanevId int
AS BEGIN
  SET NOCOUNT ON;
  
SELECT
   ott.ID AS OraTulajdonsagId
  ,ISNULL(tot.C_BOOLERTEK, ott.C_BOOLDEFAULT) AS Ertek
FROM T_ORATULAJDONSAGTIPUS_OSSZES ott
  LEFT JOIN T_TANITASIORATULAJDONSAG_OSSZES tot ON tot.C_ORATULAJDONSAGID = ott.ID AND tot.C_TANEVID = ott.C_ALTANEVID AND tot.TOROLT = 'F' AND tot.C_TANITASIORAID = @pTanitasiOraId
WHERE ott.C_ALTANEVID = @pTanevId
  AND ott.TOROLT = 'F'
  AND ott.ID BETWEEN 8356 AND 8615

END