Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
SQL query samples.
SELECT meta_key, meta_value
FROM wp_postmeta
WHERE meta_key = "issue_id"
But I need to only do posts with a category of
UPDATE wp_postmeta SET meta_value = '0' WHERE meta_value = '1';
UPDATE eccklive_usermeta SET meta_value = 'Associate Membership' WHERE meta_value = 'Associate Corporate Membership'; UPDATE eccklive_usermeta SET meta_key = 'other_business_sector' WHERE meta_key = 166; UPDATE eccklive_usermeta SET meta_key = 'member_first_name' WHERE meta_key = 193;
SELECT meta_id, post_id, meta_key, meta_value
FROM wp_postmeta
WHERE meta_key = "issue_id";
UPDATE wp_postmeta SET meta_value = 0 WHERE meta_value > 0;
UPDATE wp_postmeta SET meta_value = 33 WHERE meta_value > 0;
SELECT object_id, term_taxonomy_id
FROM wp_term_relationships
WHERE term_taxonomy_id = 9;
SELECT wp_term_relationships.term_taxonomy_id, wp_term_relationships.object_id, wp_postmeta.post_id, wp_postmeta.meta_key, wp_postmeta.meta_value
FROM wp_term_relationships
JOIN wp_postmeta
ON wp_postmeta.post_id=wp_term_relationships.object_id
WHERE term_taxonomy_id = 9 AND meta_key = 'issue_id' AND meta_value != 0;
update wp_postmeta AS a
join wp_term_relationships AS b
ON a.post_id=b.object_id
SET meta_value=0
WHERE term_taxonomy_id = 9 AND meta_key = 'issue_id' AND meta_value != 0;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.