Trotor Posted February 28, 2016 Share Posted February 28, 2016 Хочу удалить баллы репутации с определённых разделов форума. Какой мне нужно составить запрос к базе данных? Link to comment Share on other sites More sharing options...
siv1987 Posted February 28, 2016 Share Posted February 28, 2016 - Пересчет счетчика пользователей удалением репутации полученной из определенного раздела: UPDATE ibf_profile_portal pp INNER JOIN ( SELECT p.author_id, rc.rep_points FROM ibf_reputation_cache rc INNER JOIN ibf_posts p ON (rc.app='forums' AND rc.type='pid' AND rc.type_id=p.pid) INNER JOIN ibf_topics t ON (t.tid=p.topic_id) WHERE t.forum_id=ид_форума ) z ON (pp.pp_member_id = z.author_id) SET pp.pp_reputation_points = pp.pp_reputation_points - z.rep_points - Удаление репутации сообщений из определенного раздела: DELETE ri.*, rc.* FROM ibf_reputation_index ri INNER JOIN ibf_reputation_cache rc ON (rc.app=ri.app AND rc.type=ri.type AND rc.type_id=ri.type_id) INNER JOIN ibf_posts p ON (ri.app='forums' AND ri.type='pid' AND ri.type_id=p.pid) INNER JOIN ibf_topics t ON (t.tid=p.topic_id) WHERE t.forum_id=ид_форума ид_форума - ид форума из которого нужно удалить репутацию постов.удалить из форумов 2,3 - t.forum_id IN (2,3)удалить из всех форумов кроме 2,3 - t.forum_id NOT IN (2,3) Запросы выполнять строго в соответствующем порядке их следования.Перед выполнением желательно сделать бэкап таблиц ibf_reputation_index, ibf_reputation_cache, ibf_profile_portal 1 Link to comment Share on other sites More sharing options...
Trotor Posted February 28, 2016 Author Share Posted February 28, 2016 @siv1987, Большое спасибо, то что надо! ид_форума - ид форума из которого нужно удалить репутацию постов.А как сразу несколько форумов подключить? Link to comment Share on other sites More sharing options...
siv1987 Posted February 29, 2016 Share Posted February 29, 2016 удалить из форумов 2 и 3 - t.forum_id IN (2,3) 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now