select * from VIEW_TBP_CONTACTSINGLEOPERAT  where exists(select * from view_tbs_user_project t2 where t2.user_account='admin1' and t2.project_id=VIEW_TBP_CONTACTSINGLEOPERAT.project_id) ORDER BY CONTACT_ID DESC
执行完上面的语句我想在加入where project_id is null 
请问高手怎么写啊 ????

解决方案 »

  1.   

    select *
      from VIEW_TBP_CONTACTSINGLEOPERAT
     where project_id is null
       and exists
     (select *
              from view_tbs_user_project t2
             where t2.user_account = 'admin1'
               and t2.project_id = VIEW_TBP_CONTACTSINGLEOPERAT.project_id)
     ORDER BY CONTACT_ID DESC
      

  2.   

    select * from VIEW_TBP_CONTACTSINGLEOPERAT where exists(select * from view_tbs_user_project t2 where t2.user_account='admin1' and t2.project_id=VIEW_TBP_CONTACTSINGLEOPERAT.project_id) and project_id is null  ORDER BY CONTACT_ID DESC
      

  3.   

    好像要用OR用AND 查不到结果