SELECT * from cms_article_data where id in( select a.id FROM cms_article a JOIN cms_category c ON c.id = a.category_id WHERE (a.category_id = '12' or c.parent_ids like '%,12,%' ) ) select * FROM cms_article a JOIN cms_category c ON c.id = a.category_id WHERE c.parent_ids like '%1ac5f93bd6cb48919b313c60cf23b645%' delete from cms_article_data where id in( select a.id FROM cms_article a JOIN cms_category c ON c.id = a.category_id WHERE (a.category_id = '12' or c.parent_ids like '%,12,%' ) ) delete FROM cms_article where id in( select a.id FROM cms_article a JOIN cms_category c ON c.id = a.category_id WHERE (a.category_id = '12' or c.parent_ids like '%,12,%' ) ) --- ====replace===== SELECT * FROM cms_article where image like '%www.lpwyx.com%' update cms_article set image= REPLACE(image, 'www.beicaiduo.com', 'www.lpwyx.com')