say i have 2 columns:
where (condition <> 'moldy' or condition <> 'soldout')
and (condition = 'ripe' or condition = 'unripe')
group by fruit
You are using
or in a not. This is the wrong approach for this.
where not (condition = 'moldy' or condition = 'soldout')
where (condition <> 'moldy' and condition <> 'soldout')
Then, I assume you want the fruits that are ONLY ripe or unripe.
select distinct Fruit from Example E1 where Condition in ('ripe','unripe') and not exists ( select E2.Fruit from Example E2 where E1.Fruit = E2.Fruit and E2.Condition in ('moldy','soldout') )