iteye_13073
2011-07-26 13:30
浏览 676

oracle数据库中NOT IN 和 NOT EXISTS为什查不到数据

SELECT GA.ADID, GA.ADNAME
      FROM GAP_AD GA
     WHERE
     exists(SELECT GAP.ADID
              FROM GAP_ADPOSITION GAP
             WHERE GAP.ADPOSITIONSTATUS = '1')
       AND NOT exists(SELECT GAP.ADID
              FROM GAP_ADPOSITION GAP
             WHERE GAP.ADPOSITIONSTATUS = '0'
                OR GAP.ADPOSITIONSTATUS = '2')
为什么查不到数据呢?
SELECT GA.ADID, GA.ADNAME
      FROM GAP_AD GA
     WHERE GA.ADID IN(SELECT GAP.ADID
              FROM GAP_ADPOSITION GAP
             WHERE GAP.ADPOSITIONSTATUS = '1')
       AND GA.ADID NOT IN (SELECT GAP.ADID
              FROM GAP_ADPOSITION GAP
             WHERE GAP.ADPOSITIONSTATUS = '0'
                OR GAP.ADPOSITIONSTATUS = '2')
这个就可以查到
哪位朋友帮帮我

2条回答 默认 最新

相关推荐 更多相似问题