Advertisement
horozov86

Task 23 - Joana Jablonska

Oct 21st, 2024 (edited)
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQL 1.29 KB | None | 0 0
  1. SELECT
  2.  
  3. TO_CHAR(ATASEND.VONLADEDATUM, 'IW') AS "WEEK",
  4. AKOPF.AUFTRAGSNUMMER AS "Order number",
  5. SKUNDEN.NAME1 AS "Customer name",
  6. SH.BEZEICHNUNG AS "Order organisation",
  7. ATASEND.VONLADEDATUM AS "Loading target date",
  8. S.LANDNAME AS "Country of Loading",
  9. ATASEND.VONLIEFERDATUM AS "Unloading traget date",
  10. SL.LANDNAME AS "Country of Unloading",
  11. CASE
  12.     WHEN ATASEND.LOCKSTATUS = 0 THEN 'FREE'
  13.     WHEN ATASEND.LOCKSTATUS = 1 THEN 'IN PLANNING'
  14.     WHEN ATASEND.LOCKSTATUS = 2 THEN 'PLANNED'
  15.     WHEN ATASEND.LOCKSTATUS = 3 THEN 'PLANNED'
  16.     WHEN ATASEND.LOCKSTATUS = 4 THEN 'FINISHED'
  17.     ELSE NULL
  18. END AS "Status",
  19. SHI.BEZEICHNUNG AS "Planning organisation",
  20. ATASEND.TANUMMER AS "TO number"
  21.  
  22. FROM
  23.     ATASEND
  24. LEFT JOIN
  25.     ASENDUNG ON ASENDUNG.SENDUNGID = ATASEND.ASENDUNGID
  26. LEFT JOIN
  27.     AKOPF ON AKOPF.NR = ASENDUNG.AKOPFNR
  28. LEFT JOIN
  29.     SKUNDEN ON SKUNDEN.NR = AKOPF.FRACHTAGNR
  30. LEFT JOIN
  31.     SHIERARCHIE SHI ON SHI.ID = ATASEND.HIERARCHIE
  32. LEFT JOIN
  33.     SHIERARCHIE SH ON SH.ID = AKOPF.HIERARCHIE
  34. LEFT JOIN
  35.     SLAND S ON S.LAND = ATASEND.VON_LAND
  36. LEFT JOIN
  37.     SLAND SL ON SL.LAND = ATASEND.NACH_LAND
  38.  
  39. WHERE
  40.     SHI.BEZEICHNUNG LIKE 'PL%'
  41.     AND ATASEND.VONLADEDATUM >= TO_DATE('01-01-2024', 'dd-mm-yyyy')
  42.     AND ATASEND.VONLADEDATUM <= TO_DATE('31-12-2024', 'dd-mm-yyyy')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement