So basically, it's like this:
The table is called phpbb_posts
The column name is post_approved
I want to run a query which deletes all rows in phpbb_posts
table in which the post_approved
value is 0 (All rows contain either a 1 or a 0 value for the column post_approved
)
I wanted to make sure I am running the correct query, before running it.
DELETE FROM phpbb_posts
WHERE EXISTS(
SELECT *
FROM phpbb_posts
WHERE (post_approved = 0)
)
Please tell me if this code is correct; or if it is wrong, please tell me the correct code.
CODE FIXED (thanks!):
DELETE FROM phpbb_posts WHERE post_approved = 0
RESULT:
35743 rows deleted. ( Query took 1.3562 sec )
PS FOR THOSE WONDERING, THIS REMOVES ALL SPAM POSTS FROM PHPBB IN ONE FELL SWOOP! (assuming you don't have any valid posts you want to approve). Instead of going through moderator and "disapproving" for 50,000 pages, you can do this! :) :) and yes I checked in the moderator queue and all the spam posts i never approved are gone! YAY!
做就是了
DELETE FROM phpbb_posts WHERE post_approved = 0
Just use
DELETE FROM phpbb_posts
WHERE post_approved = 0
that should do it fine.
I would think just:
DELETE FROM phpbb_posts
WHERE post_approved = 0;
Would suffice
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.