开发者

Need to delete all tags with 1 count from database

开发者 https://www.devze.com 2023-02-25 19:46 出处:网络
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?

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

精彩评论

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

关注公众号