The reason you are getting both rows back is because f1 is not
identical in each. You need to remove f1 from the group by and add an
aggregator to the select list.
Something like this:
select max(f1), f2
from table1
inner join table2 on table1.id = table2.fid
where .....
group by f2
having count(f2) = 1