Сообщество IT-специалистов
Ответы на любые вопросы об IT
Профессиональное развитие в IT
Удаленная работа для IT-специалистов
DELETE FROM table1 AS t1 WHERE t1.id NOT IN ( SELECT t2.id FROM table2 AS t2 LEFT JOIN table3 AS t3 ON t3.id = t2.id WHERE t3.published = 1)
DELETE t1 FROM table1 AS t1 LEFT JOIN table2 AS t2 ON (t1.id=t2.id) LEFT JOIN table3 AS t3 ON (t3.id = t2.id AND t3.published = 1) WHERE t2.id IS NULL