
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

-- =============================================
-- Author:		marek
-- Create date: 16-07-2009
-- Description:	Zwraca daty emisji dla konkretnej reklamy
-- =============================================
ALTER PROCEDURE [dbo].[sp_GetDatyEmisjiByReklama]
	-- Add the parameters for the stored procedure here
	 @reklama INT
AS
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;

	SELECT CAST(N.NRW AS INT) AS NumerWydania, N.Data_W AS DataWydania
	FROM [UKAŻE SIĘ W NR] U
	INNER JOIN Reklama R ON R.ReklamaId = U.ReklamaId
	INNER JOIN Nr N ON R.[Tytuł] = N.Tyt AND N.NRW=U.[Nr Wydania]
	WHERE (R.ReklamaId = @reklama) ORDER BY [Nr Wydania]
END
GO

SET ANSI_NULLS OFF
GO
SET QUOTED_IDENTIFIER OFF
GO

