create table markdetails(id int, mark int) Insert into markdetails values(1,50),(1,60),(1,70),(2,50),(2,60),(3,50),(3,50),(4,50),(5,50),(5,60)
select p1.id, p1.mark from ( select distinct mark, id from markdetails where mark=50 )as p1 left outer join ( select distinct id from markdetails where mark<>50 )as p2 on p1.id= p2.id where p2.id is null
SELECT DISTINCT ID,MARK From markdetails WHERE Mark in(50) AND ID NOT IN ( SELECT ID FROM markdetails WHERE Mark not in(50))
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)