Need to delete all tags with 1 count from database
I have a big tag database which has 100s of thousands of "1 count tag" rows:
Is there a easy way I can remov开发者_Python百科e all these rows from my datebase? deleting them one by one would take me a life time :D
delete from tags where tag_count = 1;
Assuming the column that has the count is called tag_count since I cannot see it.
Assuming you have a Tags
table that defines the tags, and a TagSummary
view that shows the number of times each tag is used, you can then do a delete query:
DELETE FROM Tags
WHERE TagID IN
(SELECT TagID From TagSummary WHERE TagCount=1)
精彩评论