I have the following table called staysafe with the following columns:
id | email | orders
The id and email columns have been populated.
I then want to go through the Wordpress postmeta table and count each time the email address appears in the row where "_billing_email" appears for the meta_key, then update the staysafe table with how many times each email address appeared.
The postmeta table is set out as:
meta_id | post_id | meta_key | meta_value
I'm using the following but keep getting a runtime error (the postmeta table is big!!), where am I going wrong?
update staysafe
set orders =
(select count(*)
from wp_postmeta
where email = meta_value)