Dienstag, 17. Juli 2012

Delta von zwei Tabellen auslesen

SELECT FULL.A AS FULL_A, DELTA.A AS DELTA_A
FROM (
    SELECT 1 AS A FROM DUAL
    UNION ALL
    SELECT 2 AS A FROM DUAL
    UNION ALL
    SELECT 3 AS A FROM DUAL   -- GEMEINSAM SELECT MIT DATUM 1. BIS AKTUELL
    UNION ALL                                      -- 1. VON OFFENER VERRECHNUNGSPERIODE
    SELECT 4 AS A FROM DUAL
    UNION ALL
    SELECT 5 AS A FROM DUAL
) FULL LEFT OUTER JOIN (
    SELECT 1 AS A FROM DUAL
    UNION ALL                                 -- ZIEL TABELLE ALLE DATEN VON
    SELECT 2 AS A FROM DUAL       -- OFFENEN VERRECHNUNGSPERIODEN
) DELTA
ON FULL.A = DELTA.A
WHERE DELTA.A IS NULL

Keine Kommentare:

Kommentar veröffentlichen