SELECT DISTINCT id FROM your_table WHERE col = 'N' EXCEPT SELECT DISTINCT id FROM your_table WHERE col = 'y'
select * from your_table where id not in (select id from your_table where generated='Y' )
select * from #temp t1 where Generated='N' and not exists (select ID from #temp t2 where Generated='Y' and t1.Id=T2.Id)
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)