开发者

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:

Need to delete all tags with 1 count from database

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

Need to delete all tags with 1 count from database


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)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜