ims.service_nachlass_lohn_auftrag.sql 755 B

123456789101112131415161718192021
  1. SET QUOTED_IDENTIFIER ON
  2. GO
  3. SET ANSI_NULLS ON
  4. GO
  5. CREATE VIEW ims.service_nachlass_lohn_auftrag AS
  6. select T1."Document No_" as "Document No",
  7. SUM(((convert(float, T1."Line Discount Amount")))) as "Auftrags_Discount_Lohn"
  8. from "NAVISION"."import"."Archived_Service_Header" T2,
  9. "NAVISION"."import"."Archived_Service_Line" T1
  10. where ((T2."No_" = T1."Document No_") and (T2."Client_DB" = T1."Client_DB"))
  11. and (((((T1."Document No_" LIKE 'WAU%') and (T2."Order Date" >= convert(datetime, '2017-01-01 00:00:00.000'))) and (((convert(float, T1."Line Discount Amount"))) <> 0)) and (T1."Type" = 3)) and (T1."Document No_" <> 'WAU17422406'))
  12. group by T1."Document No_"
  13. -- order by "Document No" asc
  14. GO
  15. SET QUOTED_IDENTIFIER OFF
  16. GO
  17. SET ANSI_NULLS OFF
  18. GO
  19. GO