dede织梦cms处理tag标签的一些sql语句

//删除待审文章所有的tag

DELETE FROM dede_taglist WHERE aid in (SELECT a.id FROM dede_archives a WHERE a.arcrank = -1)

//清除所有待审文章的tag标签

DELETE FROM dede_taglist WHERE arcrank = -1

//清除total统计

UPDATE dede_tagindex SET total = 0

//更新tagindex表 total统计

UPDATE dede_tagindex AS ti , (SELECT count(*) AS c, tid AS tid from dede_taglist GROUP BY tid) AS tl SET ti.total = tl.c WHERE tl.tid = ti.id

//删除tag标签为0的
DELETE FROM dede_tagindex WHERE total = 0

Comments are closed.