I'm trying to get data from two tables they are wp_users, and opt_in.
The tables both have an email column (the only common between them), and I'm trying to get results that look like this, where I have the wp_users login name, and the rest of the opt_in table data:
wp_users.user_login, email, opt_in.first_name, opt_in.last_name
The query I've written is too slow. With around 100k rows in each table, I haven't get results without putting a limit on the query. I must not be using the right tool for the job. Show me the error of my ways.
Here's an example of the query which gives me the right data, but is very slow:
SELECT wp_users.user_email, opt_in.first_name, opt_in.last_name
FROM wp_users, opt_in
WHERE wp_users.user_email = opt_in.email;