I have 3 tables (aluno, matricula and agregado_familiar) and i´m trying to delete one entity from the first one, but it have foreign keys to the other tables. I tryied to delete them with this code and didn´t work:
$sql ="DELETE * from matricula,aluno_agregado,aluno WHERE n_processo=$n_processo";
$result = DBExecute($sql);
return $result;
I tryied this too:
$sql ="DELETE FROM matricula WHERE n_processo=$n_processo";
$sql1 ="DELETE FROM aluno_agregado WHERE n_processo=$n_processo";
$sql2 ="DELETE FROM aluno WHERE n_processo=$n_processo";
$result = DBExecute($sql,$sql1,$sql2);
return $result;
I´m not sure if this is possible, but if i don´t delete from the 3 tables it will not let me delete the "aluno". I tryied to do a join too, but I don´t know how to do it.