找到不符合标准的行

时间:2018-03-28 19:14:38

标签: sql oracle plsql plsqldeveloper

我正在尝试验证更新参与分数的新夜间程序。我有一个从验证中返回的461个ID#列表....在下面的查询中确认回来的信息是正确的,我发现461中有233个符合条件,使用下面的代码。我的问题是找到不符合标准的行。任何帮助,将不胜感激!感谢

SELECT DISTINCT * FROM TEMP_TABLE w

JOIN entity e ON e.id_number = w.id_number
        AND e.id_number IN (‘ ID NUMBERS IN QUESTION PUT HERE ‘)

JOIN xcomment c ON c.id_number = e.id_number
           AND c.comment_code = 'ES'

WHERE EXISTS (SELECT 1 FROM activity a 
       WHERE a.id_number = e.id_number
       AND to_char(a.date_added, 'YYYYMMDD') >= '20180101'
       AND to_char(a.date_added, 'YYYYMMDD') <= '20180307')

1 个答案:

答案 0 :(得分:0)

SELECT DISTINCT * FROM TEMP_TABLE w

JOIN entity e ON e.id_number = w.id_number
        AND e.id_number IN (‘ ID NUMBERS IN QUESTION PUT HERE ‘)

JOIN xcomment c ON c.id_number = e.id_number
           AND c.comment_code = 'ES'

WHERE not EXISTS (SELECT 1 FROM activity a 
       WHERE a.id_number = e.id_number
       AND to_char(a.date_added, 'YYYYMMDD') >= '20180101'
       AND to_char(a.date_added, 'YYYYMMDD') <= '20180307')