一条sql删除多个表中的数据

DELETE 
	a.*,
	b.* 
FROM
	domain_project_tbl b
	RIGHT JOIN project_tbl a ON a.sn = b.project_sn 
WHERE
	a.name = '' 
	AND a.is_del !=1


DELIMITER $
CREATE TRIGGER del_d_p BEFORE DELETE ON project_tbl FOR EACH ROW
BEGIN
DELETE 
FROM
	domain_project_tbl 
WHERE
	project_sn = ( SELECT ifnull( sn, '' ) FROM project_tbl WHERE NAME = '' );
END$

 

你可能感兴趣的:(java,sql)