test.NW_GW_VK_V03.sql 651 B

1234567891011121314151617181920212223
  1. SET QUOTED_IDENTIFIER ON
  2. GO
  3. SET ANSI_NULLS ON
  4. GO
  5. CREATE VIEW [test].[NW_GW_VK_V03] AS
  6. SELECT format([Invoice_Date], 'yyyy-MM') AS [Periode]
  7. , [Verkäufer]
  8. , sum(try_convert(decimal(28, 8), replace([Menge], ',', '.'))) AS [Menge]
  9. , sum([Gesamterlöse]) AS [Erlös_FZG]
  10. , sum([Einsatz_Gesamt]) AS [Einsatz_FZG]
  11. , sum([Erlös_Prov_]) AS [Erlös_Prov_]
  12. , avg(try_convert(decimal(28, 8), [Standtage])) AS [Standtage]
  13. FROM [transform].[NW_GW_VK]
  14. WHERE [Invoice_Date] >= datefromparts(year(getdate()), 1, 1)
  15. GROUP BY format([Invoice_Date], 'yyyy-MM'), [Verkäufer]
  16. GO
  17. SET QUOTED_IDENTIFIER OFF
  18. GO
  19. SET ANSI_NULLS OFF
  20. GO
  21. GO