Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8888591
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T22:04:56+00:00 2026-06-14T22:04:56+00:00

i have an information table that has the following fields in it; id, staffMember,

  • 0

i have an information table that has the following fields in it;

id, staffMember, lineManager, description

The staffMember and lineManager fields return integer values that correspond to the id of rows within a users table which has the following columns

id, firstname, surname

I can use the following query to return the info in my information table, substituting the staffMember value for a CONCAT of firstname and surname:

SELECT information.id, 
    CONCAT( users.firstname,  ' ', users.surname ) AS staffMember, 
    information.lineManager, 
    LEFT(information.description,200) As description 
FROM information 
LEFT JOIN users 
    ON ( information.staffMember = users.id ) 
LIMIT 0 , 30"

But what i want to be able to do, is repeat the process that’s working on the value of staffMember on lineManager as well in the same query (which i then pass as a json string) – however, i know i can’t have two LEFT joins to the same table but equating different fields.

Any help would be gratefully received.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T22:04:56+00:00Added an answer on June 14, 2026 at 10:04 pm

    It sounds like you want this:

    SELECT i.id, 
        CONCAT(u1.firstname,  ' ', u1.surname) AS staffMember, 
        CONCAT(u2.firstname,  ' ', u2.surname  AS lineManager, 
        LEFT(i.description,200) As description 
    FROM information i
    LEFT JOIN users u1
        ON i.staffMember = u1.id 
    LEFT JOIN users u2
        on i.lineManager = u2.id
    LIMIT 0 , 30
    

    You just perform a LEFT JOIN on the users table twice. Once you will join on the staffMember and the other time you will join on lineManager. By providing a different table alias to the table you can distinguish between the tables and the values.

    Of if you want to be clearer:

    SELECT i.id, 
        CONCAT(staff.firstname,  ' ', staff.surname) AS staffMember, 
        CONCAT(manager.firstname,  ' ', manager.surname  AS lineManager, 
        LEFT(i.description,200) As description 
    FROM information i
    LEFT JOIN users staff
        ON i.staffMember = staff.id 
    LEFT JOIN users manager
        on i.lineManager = manager.id
    LIMIT 0 , 30
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a table that stores user information. The table has a userid (identity)
I have a mongo table that has statistical data like the following.... course_id status
i have a table that holds my users information like username , password ,
I have two tables: a schedule table that contains information about how an employee
Given that I have a table that holds vehicle information and one of those
I have a table (user) that contains user information. I have another table (userview)
I have a jsp that contains a table with some information from db. I
I have a comparison table that has about 20 items. I would like when
i have a DB2 table (orderitems) that has columns named ORDERITEMS_ID and ORDERS_ID I'm
What I have: I have a master dataframe that has the following columns: userid,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.