SQL to check merged and disabled topics

Find all topics that are merged to host topics and update the topic_comments_history table; select cgroup_id, a.topic_id, c.host_topic_id from topic_comments_history a join topic b join topic_merge c on a.topic_id = b.topic_id and b.topic_id = c.topic_id where status = 2; select * from topic where status = 2 and articles > 0 order by articles desc limit 10000; select * from topic_comments_history a join topic b on a.topic_id = b.topic_id where a.topic_id =2731005 order by cgroup_id desc; select count(*), date(a.create_date) from user_comment_view a join topic_comments_history b on a.cgroup_id=b.cgroup_id where topic_id = 2720538 and date(a.create_date) > '2016-05-01' group by date(a.create_date) limit 10000; select count(*), date(a.create_date) from user_comment_view a join topic_comments_history b on a.cgroup_id=b.cgroup_id where topic_id in (select topic_id from topic where articles =1 AND status = 1 AND (title like 'movie%' or title like '% movie%' or title like '% movies' ) ) and date(a.create_date) > '2016-05-01' group by date(a.create_date) limit 10000;

Comments