Advertisement
horozov86

Task 20 - SQL

Oct 17th, 2024 (edited)
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQL 0.94 KB | None | 0 0
  1. SELECT
  2.     LKWKZ AS "Truck number",
  3.     ANHAENGERKZ AS "Trailer number",
  4.     SK.NAME1 AS "GOPET LOGISTICS EOOD as Sender",
  5.             CASE WHEN SK.KUNDENNR = 23164813 THEN LADEDATUMSTARTIST END AS "Loading date when Sender is GOPET LOGISTICS EOOD",
  6.  
  7.        
  8.     SKU.NAME1 AS "GOPET LOGISTICS EOOD as Receiver",
  9.                 CASE WHEN SKU.KUNDENNR = 23164813 THEN LIEFERDATUMENDEIST END AS "Unloading date when Receiver is GOPET LOGISTICS EOOD",
  10.  
  11.     S.NAME1 AS "Carrier name",
  12.     TOURNUMMER AS "Tour number"
  13. FROM ATOUR
  14. JOIN ATASEND ON ATOUR.NR = ATASEND.TOURNR
  15. JOIN ASENDUNG ON ASENDUNG.SENDUNGID = ATASEND.ASENDUNGID
  16. JOIN SKUNDEN S ON S.NR = ATOUR.UNTERNEHMER
  17. JOIN SKUNDEN SK ON SK.NR = ASENDUNG.ABSNR
  18. JOIN SKUNDEN SKU ON SKU.NR = ASENDUNG.EMPFNR
  19.  
  20. WHERE LADEDATUMENDEIST >= TO_DATE('01-01-2023', 'dd-mm-yyyy')
  21. AND LADEDATUMENDEIST <= TO_DATE('31-12-2023', 'dd-mm-yyyy')
  22. AND (SK.KUNDENNR = 23164813 OR SKU.KUNDENNR = 23164813);
  23.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement