Hi there,
i got a tbl_categoie and a tbl_branchen. A Categorie can have N branches.
When I delete a categorie, I want to delte all its branches too, and this in one statement.
I tried the following:
$SQL = "DELETE
tbl_rubriken,
tbl_branchen
FROM
tbl_rubriken,
tbl_branchen
WHERE tbl_branchen.rubrikid = tbl_rubriken.id
AND tbl_rubriken.id = '$rubid' ;";
It works when the categorie has at least one branche, but when the categorie has no branches, it doesn't get deleted.
I've not worked with these mDelte-statements yet and I'm not so experienced in SQL, so I hope you can help me.
Thx a lot,
greets ben
i got a tbl_categoie and a tbl_branchen. A Categorie can have N branches.
When I delete a categorie, I want to delte all its branches too, and this in one statement.
I tried the following:
$SQL = "DELETE
tbl_rubriken,
tbl_branchen
FROM
tbl_rubriken,
tbl_branchen
WHERE tbl_branchen.rubrikid = tbl_rubriken.id
AND tbl_rubriken.id = '$rubid' ;";
It works when the categorie has at least one branche, but when the categorie has no branches, it doesn't get deleted.
I've not worked with these mDelte-statements yet and I'm not so experienced in SQL, so I hope you can help me.
Thx a lot,
greets ben