Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT
- A1.AUFTRAGSNUMMER AS "Order number", A1.AEXTERNAUFTRAGSNR AS "Client reference", SKUNDEN.NAME1 AS "Client name", SKUNDEN.MAINLAND AS "Country of the client",
- SHIER.NR AS "Number of organisation", SHIER.BEZEICHNUNG AS "Name of organisation", LISTAGG(AT.TOURNUMMER, ', ') WITHIN GROUP (ORDER BY AT.TOURNUMMER) AS "Tour numbers",
- TO_CHAR(MIN(ATASEND.VONLADEDATUM), 'DD-MM-YYYY') AS "First loading date"
- FROM AKOPF A1
- LEFT JOIN SHIERARCHIE SHIER ON SHIER.ID = A1.HIERARCHIE
- LEFT JOIN ASENDUNG ON A1.NR = ASENDUNG.AKOPFNR
- LEFT JOIN ATASEND ON ATASEND.ASENDUNGID = ASENDUNG.SENDUNGID
- LEFT JOIN ATOUR AT ON AT.NR = ATASEND.TOURNR
- LEFT JOIN SKUNDEN ON SKUNDEN.NR = A1.FRACHTAGNR
- WHERE (AT.LKWKZ IS NOT NULL OR AT.ANHAENGERKZ IS NOT NULL) AND A1.AUFTRAGSNUMMER IN (908243, 220785)
- GROUP BY A1.AUFTRAGSNUMMER, A1.AEXTERNAUFTRAGSNR, SKUNDEN.NAME1, SKUNDEN.MAINLAND, SHIER.NR, SHIER.BEZEICHNUNG
- ORDER BY MIN(ATASEND.VONLADEDATUM) ASC;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement