DROP PROCEDURE IF EXISTS uspGetTanevRendjeOsztalyCsoportok
GO

CREATE PROCEDURE uspGetTanevRendjeOsztalyCsoportok
   @pTanevId int
  ,@pTanevrendIds nvarchar(4000)

AS 
BEGIN
  SET NOCOUNT ON;

  SELECT
      tr.ID AS ID
     ,ocs.C_NEV AS OsztalyCsoportNev
  FROM T_TANEVRENDJE_OSSZES tr
    INNER JOIN T_OSZTALYCSOPORT_TANEVRENDJE ocst ON ocst.C_TANEVRENDJEID = tr.ID
    INNER JOIN T_OSZTALYCSOPORT_OSSZES ocs ON ocs.ID = ocst.C_OSZTALYCSOPORTID
  WHERE tr.ID IN (SELECT value FROM STRING_SPLIT(@pTanevrendIds, ','))
    AND tr.C_TANEVID = @pTanevId
    AND tr.TOROLT = 'F'
END

GO

