I have entries in wp_postmeta like so (shortened for brevity:
post_id | meta_key | meta_value
integer | _thumbnail_id | integer
integer | rafi | integer
Now it's easy to select and delete all rows containing _thumb.
Same with rows containing rafi.
What I need to do is delete the rows with a common post_id AND both _thumb and rafi.
The reason is I only want to remove the featured image from posts that have the rafi key set.
I can delete matching _thumbnail_id rows thusly:
DELETE FROM $wpdb->postmeta WHERE meta_key = '_thumbnail_id'
But I am not sure how to proceed in terms of doing the proper selecting of the matching rows to set up the deletion.
Thanks for any ideas!