Вы можете использовать агрегирование и предложение having
:
select seller_id
from t
group by seller_id
having min(shop_status) = max(shop_status) and min(shop_status) = 'close';
Если у вас есть отдельный список продавцов, то not exists
может быть быстрее:
select s.*
from sellers s
where not exists (select 1
from t
where t.seller_id = s.seller_id and
t.shop_status <> 'close'
);
EDIT :
Если shop_status
может быть NULL
, и вы хотите их исключить, вы можете использовать:
select seller_id
from t
group by seller_id
having min(shop_status) = max(shop_status) and
min(shop_status) = 'close' and
count(*) = count(shop_status);
И:
select s.*
from sellers s
where not exists (select 1
from t
where t.seller_id = s.seller_id and
(t.shop_status <> 'close' or t.shop_status is null)
);