wp_sql

UPDATE wp_term_taxonomy tt
        SET count =
        (SELECT count(p.id) FROM  wp_term_relationships tr
        LEFT JOIN wp_posts p
        ON (p.id = tr.object_id AND p.post_type = 'post')
        WHERE tr.term_taxonomy_id = tt.term_taxonomy_id);
		
select w.id from wp_posts w where NOT EXISTS (select c.comment_ID from wp_comments c where c.comment_post_ID=w.id);
delete from wp_posts where ID not in (select comment_post_ID from wp_comments);

 ------------------------------------------------------
update wp_posts
set post_date= DATE_ADD(post_date, INTERVAL FLOOR(1 + (RAND() * 45)) DAY),
post_date_gmt=post_date
where post_date > now();
--and id BETWEEN 1 AND 500;

-- select FLOOR(1 + (RAND() * 45)); рандом от 1 до 45

 ------------------------------------------------------
 
UPDATE wp_options SET option_value = replace(option_value, 'http://host7', 'http://newdomain.ru') WHERE option_name = 'home' OR option_name = 'siteurl';

UPDATE wp_posts SET guid = replace(guid, 'http://host.ru','http://newdomain.ru');

UPDATE wp_posts SET post_content = replace(post_content, 'http://host.ru', 'http://newdomain.ru');
UPDATE wp_postmeta SET meta_value = replace(meta_value, 'http://host.ru', 'http://newdomain.ru');

CREATE TABLE IF NOT EXISTS newdomain (`site` int(11) NOT NULL);
UPDATE wp_posts SET post_status = 'publish' where post_status ='future';
delete from wp_posts where post_content='';

update wp_posts set post_content = replace(post_content, '<h4>', '<b>');
update wp_posts set post_content = replace(post_content, '</h4>', '</b>');
update wp_posts set post_content = replace(post_content, 'Ещё', '');


UPDATE wp_options SET option_value = 'newdomain.ru' WHERE option_name = 'blogname';
UPDATE wp_options SET option_value = '' WHERE option_name = 'blogdescription';
UPDATE wp_options SET option_value = 'suevafree' WHERE option_name = 'template';
UPDATE wp_options SET option_value = 'suevafree' WHERE option_name = 'stylesheet';