I have this query select latitude, longitude, username, rank from users, but I only want that info if the username exist in my online_users db. That look like this:
id bigint(20)
username varchar(16)
ip varchar(39)
time datetime
So if I have 3 users in my online_users db, I want the latitude, longitude, username and rank from my users table from those 3 users. How do I do this? I assume UNION something, but my sql skills are limited.
Assuming that these are two tables in the same database, and not two databases (as stated), then either of the following will work: