(SELECT DISTINCT company_id FROM holdings_companies) AND id IN (SELECT DISTINCT company_id FROM company_buh_rosstat WHERE company_id NOT IN (SELECT DISTINCT company_id FROM company_buh_rosstat WHERE year LIKE 2021))
Посмотрите план запроса
SELECT id FROM company WHERE id IN (SELECT DISTINCT company_id FROM holdings_companies) AND id IN (SELECT DISTINCT company_id FROM company_buh_rosstat WHERE year <> 2021)
Обсуждают сегодня