sql - How can I delete all rows within a table in a mysql database, which value = 0 for one of the columns? -
so basically, it's this:
the table called phpbb_posts
the column name post_approved
i want run query deletes rows in phpbb_posts
table in post_approved
value 0 (all rows contain either 1 or 0 value column post_approved
)
i wanted make sure running correct query, before running it.
delete phpbb_posts exists( select * phpbb_posts (post_approved = 0) )
please tell me if code correct; or if wrong, please tell me correct code.
code fixed (thanks!):
delete phpbb_posts post_approved = 0
result:
35743 rows deleted. ( query took 1.3562 sec )
p.s. wondering, removes spam posts phpbb in 1 fell swoop! (assuming don't have valid posts want approve). instead of going through moderator , "disapproving" 50,000 pages, can this! :) :) , yes checked in moderator queue , spam posts never approved gone! yay!
just do
delete phpbb_posts post_approved = 0
Comments
Post a Comment