Hello, I have got 3 tables as posts, posts_tags and tags. I want delete according to post ID. How do I manage it? My beginner query: DELETE tags,post_tags,posts FROM tags,post_tags,posts WHERE posts.id=133 AND tags.id = post_tags.tagid AND posts.id = post_tags.postid Code (markup):
Do it in 3 delete statements, in the following order. DELETE FROM tags WHERE tags.id in (SELECT post_tags.tagid FROM post_tags WHERE post_tags.postid=133; DELETE FROM post_tags WHERE post_tags.postid=133; DELETE FROM posts WHERE posts.id=133;