I’m trying to run a SQL query from a WordPress database. Basically, I need to get the email address of all users from the wp_users table and then check to see if those users have a value that is not null in the row ‘agent_name’ in the wp_usermeta table. So something like this pseudo code SELECT user_email FROM 'wp_users' and SELECT agent_name FROM 'wp_usermeta'
. The goal is to have the query printed out in a csv (that part I can figure out). You can see an example of the kind of output I’m looking for in this screenshot:
I hope that makes sense.
You should use an
INNER JOIN
to achive this: