Unclear if you want to
- exclude Nurses that work with Doctor 2 on other wards, or
- exclude nurses only if they work with Doctor 2 on Ward 2,
If the former:
Select Nurse From Table T
Where Ward = 'W2'
And Doctor = 'DR1'
And Not Exists (Select * From Table
Where Nurse = T.Nurse
And Doctor = 'DR2')
if the latter,
Select Nurse From Table T
Where Ward = 'W2'
And Doctor = 'DR1'
And Not Exists (Select * From Table
Where Nurse = T.Nurse
And Ward = 'W2'
And Doctor = 'DR2')
Charles Bretana
2009-07-19 16:36:51