Announcement

Collapse
No announcement yet.

2 Abfragen zusammenführen

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • 2 Abfragen zusammenführen

    Hallo! ich bin noch ein sqlanfänger und deshalb wende ich mich vertrauensvoll an euch - ich habe folgende zwei abfragen welche mir auch die richtigen Werte bringen.
    jetzt möchte ich diese zwei Abfragen so verbinden, dass mir p.position_id(Abgrage 1) und p.position_id (Abfrage 2) subtrahiert werden und mir nur die Position_ids angezeigt werden, die nicht in AbFrage 1 stehen wie ein Ungleich
    danke für eure hilfe
    lg
    michaelf2050
    Code:
    --Abfrage 1:
     SELECT e.event_position_id,
             p.position_id,
             p.code,
             g.gamedev_id,
             g.position_id AS g_position_id,
             s.gamedev_id AS slot_gamedevID,
             e.event_time,
             e.par_value_1,
             e.event_id
        FROM grips.event_log e,
             grips.position p,
             grips.gamedev g,
             grips.gamedev_slot s
       WHERE     p.position_typ = 1
             AND p.bso_id IS NOT NULL
             AND e.event_id = 2001
             AND e.Par_value_1 = 0
             AND e.event_time BETWEEN TRUNC (SYSDATE)
                                      + ( ( (TO_NUMBER (TO_CHAR (SYSDATE, 'HH24')))
                                           - 1)
                                         / 24)
                                      - 10 / 24 / 60
                                  AND TRUNC (SYSDATE)
                                      + ( ( (TO_NUMBER (TO_CHAR (SYSDATE, 'HH24')))
                                           - 1)
                                         / 24)
                                      + 10 / 24 / 60
             AND g.gamedev_typ = 1
             --and s.sma_smc_id = Null
             --and s.stm_id = null
             --and s.mdc_ID =null;
             AND e.event_position_id = G.POSITION_ID
             AND p.position_id = G.POSITION_ID
             AND g.gamedev_id = s.gamedev_id
    ORDER BY p.code;
    
    --Abfrage 2:
    
    SELECT p.position_id, g.position_id, g.gamedev_id
      FROM grips.position p, grips.gamedev g
     WHERE     g.gamedev_id IS NOT NULL
           AND p.position_typ = 1
           AND p.position_id = g.position_id;
Working...
X