SQL select instance in table if it does no longer exist with later year value

You should use a correlated exists, such as

select team
from t
where year=2011
and not exists (select * from t t2 where t2.year = 2012 and t2.team = t.team);

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top