In a table like:
I want to return
DISTINCT Col1 if (Col2=05/01/2000 and Col3=TRUE) but among these, if there is a
(Col2<'2000-01-03' and Col3=TRUE) then it should be removed.
I know the easiest thing is to do
SELECT DISTINCT Col1 from TABLE where (Col2='2000-01-05' and Col3=TRUE) and Col1 not in (SELECT DISTINCT Col1 from TABLE where (Col2<'2000-01-03' and Col3=TRUE)
However, this doubles the processing effort as it does two separate filtering.
Is it possible to combine these in one SELECT/WHERE?