SQL Query

Welcome To Extralicense, Forum Promotion, SEO, Domain Names, Hosting & More!

Buy, sell trade your licenses,Connect with fellow webmasters. Grow your network. Learn and share with us!

Dan

Well-known member
Valued Member
Nov 13, 2019
1,791
540
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.

 

starship

Well-known member
Valued Member
Jun 17, 2011
887
292
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

Dan

Well-known member
Valued Member
Nov 13, 2019
1,791
540
Ragtek, you are the man! I will give this a go in a bit. Thanks!!!

 
Top