Advertisement
horozov86

Task 7 - SQL

Aug 28th, 2024 (edited)
245
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. SELECT
  2.     AKOPF.AUFTRAGSNUMMER AS "Order number",
  3.     SHIERARCHIE.BEZEICHNUNG AS "Order organisation",
  4.     SKUNDEN.NAME1 AS "Customer",
  5.     SUM(ASDGABRECHNUNG.BETRAG) AS "Amount",
  6.     SUM(ASDGABRECHNUNG.BETRAGSTP) AS "Amount without TAX",
  7.     SUM(ASDGABRECHNUNG.CALCSTATSTEUERBETRAG) AS "TAX Amount",
  8.     SUM(ASDGABRECHNUNG.BETRAG) + SUM(ASDGABRECHNUNG.BETRAGSTP) + SUM(ASDGABRECHNUNG.CALCSTATSTEUERBETRAG) AS "Total Income",
  9.     SWAEHRUNG.ISOWAEHRUNGSCODE AS "Currency"
  10.    
  11.  
  12. FROM
  13.     AKOPF
  14. LEFT JOIN
  15.     SHIERARCHIE ON SHIERARCHIE.ID = AKOPF.HIERARCHIE
  16. LEFT JOIN
  17.     ASENDUNG ON ASENDUNG.AKOPFNR = AKOPF.NR
  18. LEFT JOIN
  19.     SKUNDEN ON SKUNDEN.NR = AKOPF.FRACHTAGNR
  20. LEFT JOIN
  21.     ASDGABRECHNUNG ON ASDGABRECHNUNG.ASENDUNGID = ASENDUNG.SENDUNGID
  22. LEFT JOIN
  23.     SWAEHRUNG ON SWAEHRUNG.ID = ASDGABRECHNUNG.WAEHRUNGID
  24. WHERE
  25.     AKOPF.AUFTRAGSNUMMER IN (633168, 633104, 634503)
  26.    
  27. GROUP BY
  28.     AKOPF.AUFTRAGSNUMMER,
  29.     SHIERARCHIE.BEZEICHNUNG,
  30.     SKUNDEN.NAME1,
  31.     SWAEHRUNG.ISOWAEHRUNGSCODE;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement