
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

ALTER view [dbo].[ZAMOWIENIA_NETTO_ZAFAKTUROWANE]
AS

SELECT Z.idZamowienia,round(sum (U.netto),2) AS nettoZafakturowane 
FROM dbo.zamowienia AS Z 
LEFT JOIN Reklama R ON Z.idZamowienia = R.idZamowienia 
LEFT JOIN [UKAŻE SIĘ W NR] U ON U.reklamaId = R.reklamaId
WHERE u.status<>2 AND zafakturowana=1
GROUP BY Z.idZamowienia
GO

SET ANSI_NULLS OFF
GO
SET QUOTED_IDENTIFIER OFF
GO

