I am having a query :
SELECT *
FROM `phpbb_posts` AS a
JOIN phpbb_posts_text AS b ON a.post_id = b.post_id
WHERE a.poster_id =5413
It gives me X number of rows, and I want a query that will delete all these rows (I don't need to select first that was just an example for the JOIN.
Any help ?
It's so simple.
DELETE a, b
FROM `phpbb_posts` AS a
JOIN phpbb_posts_text AS b ON a.post_id = b.post_id
WHERE a.poster_id =5413
You can delete each table separately
DELETE b
FROM phpbb_posts_text AS b
INNER JOIN `phpbb_posts` AS a
ON
a.post_id = b.post_id
AND a.poster_id =5413
DELETE a
FROM `phpbb_posts` AS a
WHERE a.poster_id =5413
the second can written as
DELETE `phpbb_posts`
WHERE poster_id =5413
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.