I want to get the results from the following table. Get all IDs and treetypes, with the exception of Apple with Id = 102.
Id TreeType
---------------------
99 Apple
99 Mango
102 Orange
101 Blackberry
102 Apple
The result will be.
Id TreeType
---------------------
99 Apple
99 Mango
102 Orange
101 Blackberry
One way to get the result from the following query.
select id, TreeType
from x
except
select id, TreeType
from x
where id = 102 and TreeType = 'Apple'
Is it possible to get the result from a single select statement?
I just want to avoid it, because in a real scenario it becomes very expensive for me.
source
share