In phpmyAdmin I would like to DELETE the content of meta_value fields in wp_postmeta table, if the content has a certain string.
When I’m using SELECT to show the rows first, my code is working and all rows with the founded string are shown correct. But if I use DELETE instead of SELECT, I’m getting the following error:
Unknown table ‘meta_value’ in ‘MULTI DELETE’
This is my code:
DELETE pm.meta_value FROM wp_postmeta pm
LEFT JOIN wp_posts wp ON wp.ID = pm.post_id
WHERE wp.post_type = 'person'
AND pm.meta_key = 'gallery'
AND pm.meta_value LIKE '%mystring%';
What did I do wrong? Thanks in advance!
2
Answers
As @Akina said, the problem was, that I used DELETE instead UPDATE, to modify or delete a single field.
Could you please try to check with the given slightly modified query. In this we have
meta_value
withpm.meta_value
.