Advertise Here | Advertise Here | Advertise Here | Advertise Here
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Attention buyers: Please take the time to read THIS
    Dismiss Notice
  3. I have imposed a new requirement today limiting who can start and receive private conversations. This is in an effort to thwart scammers who have a zero post count but private message others offering to sell their licenses. The restriction is not strict, a user must post at least one (1) post in the forum before being allowed to start and/or receive private conversations. Read Forum Post
    Dismiss Notice
  4. Dismiss Notice
Dismiss Notice
Introducing the new Classifieds Section

Please see HERE for more info.

SQL Query

Discussion in 'General Chat' started by Dan, Jan 21, 2012.

  1. Dan

    Dan Admin Staff Member

    Local Time:
    12:46 AM
    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.
     
  2. starship

    starship Registered

    Local Time:
    7:46 AM
    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 )
     
  3. Dan

    Dan Admin Staff Member

    Local Time:
    12:46 AM
    Ragtek, you are the man! I will give this a go in a bit. Thanks!!!
     

Share This Page