Advertisement
horozov86

Task 8 - SQL

Aug 29th, 2024
509
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. SELECT
  2.     ATOUR.TOURNUMMER AS "Tour number",
  3.     SHIERARCHIE.BEZEICHNUNG AS "Organisation",
  4.     SKUNDEN.NAME1 AS "Carrier Name",
  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 Expenses",
  9.     SWAEHRUNG.ISOWAEHRUNGSCODE AS "Currency"
  10.  
  11. FROM ATOUR
  12.  
  13. LEFT JOIN
  14.     SHIERARCHIE ON SHIERARCHIE.ID = ATOUR.HIERARCHIE
  15. LEFT JOIN
  16.     SKUNDEN ON SKUNDEN.NR = ATOUR.UNTERNEHMER
  17. LEFT JOIN
  18.     ATASEND ON ATASEND.TOURNR = ATOUR.NR
  19. LEFT JOIN
  20.     ASDGABRECHNUNG ON ASDGABRECHNUNG.ATAID = ATASEND.NR
  21. LEFT JOIN
  22.     SWAEHRUNG ON SWAEHRUNG.ID = ASDGABRECHNUNG.WAEHRUNGID
  23.  
  24. WHERE
  25.     ATOUR.TOURNUMMER IN (288371, 307961, 286635)
  26.    
  27. GROUP BY
  28.     ATOUR.TOURNUMMER,
  29.     SHIERARCHIE.BEZEICHNUNG,
  30.     SKUNDEN.NAME1,
  31.     SWAEHRUNG.ISOWAEHRUNGSCODE;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement