ExtraLicense - Buy, Sell, & Trade Your Licenses

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

SQL Query

Dan

Well-known member
Valued Member
Left joins suck :p

I have a huge headache I am hoping someone can cure by helping me with some code.

I have 2 tables:

user_online

user

user_online only holds user_id

user has user_id and user_name

I need code to grab and list user_name(s) of the user_id(s) that are present in the user_online table

Clear as mud? Thanks for anyone offering any help.

 
I think you're searching for

SELECT user.user_name

FROM user_online AS session_activity

LEFT JOIN user AS user ON ( user.user_id = session_activity.user_id )

 
  • Like
Reactions: Dan
Ragtek, you are the man! I will give this a go in a bit. Thanks!!!

 
Top