Adding EXISTS and NOT EXISTS to WHERE statement