gpt4 book ai didi

mysql - 删除 0 次浏览的 WordPress 帖子 [wp_postviews 插件]

转载 作者:行者123 更新时间:2023-11-29 14:51:23 25 4
gpt4 key购买 nike

我认为这个选择非常完美......有什么建议吗?

SELECT * 
FROM `wp_posts` , `wp_postmeta`
WHERE `post_type` = 'post'
AND post_id = ID
AND DATEDIFF( NOW( ) , `post_date` ) >400
AND meta_key = "views"
AND meta_value =0;

问题是我不知道如何删除所有这些帖子!有什么帮助吗?谢谢

最佳答案

[编辑,评论后 - 未经测试,因此可能不是 100% 正确]

create table post_ids_to_remove (postid bigint);

insert into post_ids_to_remove (postid) values (
SELECT post_id
FROM `wp_posts` , `wp_postmeta`
WHERE `post_type` = 'post'
AND post_id = ID
AND DATEDIFF( NOW( ) , `post_date` ) >400
AND meta_key = "views"
AND meta_value =0
)

delete from `wp_postmeta` where post_id in(
SELECT postid
FROM `post_ids_to_remove`
);

delete from `wp_posts` where id in(
SELECT postid
FROM `post_ids_to_remove`
);

drop table post_ids_to_remove;

关于mysql - 删除 0 次浏览的 WordPress 帖子 [wp_postviews 插件],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5677463/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com