Category Archives: SQL

mySQL text find and replace in field

 SQL |  copy code |? 
1
UPDATE TABLE_NAME SET column_name = REPLACE (column_name, 'current string', 'new string');

Posted in SQL | Leave a comment

WordPress change image links etc in database

 SQL |  copy code |? 
1
UPDATE wp_posts SET guid = REPLACE (guid, 'http://www.oldurl.com', 'http://www.newurl.com');

Posted in SQL, Tips and Tricks, Wordpress 3 | Leave a comment

WordPress 3 Delete Post Revisions

 SQL |  copy code |? 
1
DELETE a,b,c FROM wp_posts a
2
LEFT JOIN wp_term_relationships b ON (a.ID = b.object_id)
3
LEFT JOIN wp_postmeta c ON (a.ID = c.post_id)
4
WHERE a.post_type = 'revision'

Posted in SQL, Tips and Tricks, Wordpress 3 | Leave a comment