Does this version work?
SELECT g.*
FROM Gift g
WHERE not exists (select 1
from ItemDetails det
where det.Active = 1 and
det.GiftId = g.GiftId
);
You can also do this as a left outer join
:
SELECT g.*
FROM Gift g LEFT OUTER JOIN
ItemDetails det
on det.Active = 1 and g.GiftId = r1.GiftId
WHERE det.GiftId IS null;
You don't need the subquery, because you can just move the filtering condition into the on
clause.