﻿DROP PROCEDURE IF EXISTS uspGetNemSzinkronizaltNebulok
GO

CREATE PROCEDURE uspGetNemSzinkronizaltNebulok
   @pTanevId int
  ,@pFelvetelStatuszaTipusFelveve int
AS
BEGIN
    SELECT
         Nebulo.ID
        ,Nebulo.C_OKTATASIAZONOSITOSZAMA AS OktatasiAzonosito
        ,Nebulo.C_SZULETESICSALADINEVE + ' ' + Nebulo.C_SZULETESIUTONEVE AS Nev
    FROM T_NEBULO Nebulo
    INNER JOIN T_INTEZMENYADATOK IntezmenyAdatok ON IntezmenyAdatok.C_INTEZMENYID = Nebulo.C_INTEZMENYID
        AND IntezmenyAdatok.C_TANEVID = Nebulo.C_TANEVID
        AND IntezmenyAdatok.TOROLT = 'F'
    WHERE Nebulo.C_FELVETELSTATUSZA = @pFelvetelStatuszaTipusFelveve
        AND Nebulo.C_KIRSTATUSZ IS NULL
        AND Nebulo.C_TANEVID = @pTanevId
        AND Nebulo.TOROLT = 'F'
END
GO
