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

  • SEARCH
  • Home
  • 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 8395903
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T20:24:47+00:00 2026-06-09T20:24:47+00:00

Does that question even make sense? I’m trying to do a Query where it

  • 0

Does that question even make sense?

I’m trying to do a Query where it pulls 2 different values from a JOIN on the same table.

I have and “Order” where there are two values, “TakenBy” & “PackedBy” These are User_IDs from a table for Employees. Most of the time they will not be the same.

How do I seporate them in the query? I can get one of them fine, but I am unsure how to retreave both values.

Here what I have for getting one..

SELECT
O.Order_ID AS OID, Customer_ID AS CID, Emp.UserName AS UserName
FROM Orders O
LEFT JOIN Employees Emp ON Emp.User_ID = O.User_ID
WHERE O.Customer_ID =3

But, what about when I want the “PackedBy?” also how do I get that too?

[Employees Table]
[User_ID] [UserName]
[1]       [Joe]
[2]       [Bill]
[3]       [Bobby]
[4]       [Steve]

[Orders]
[Order_ID] [Customer_ID] [TakenBy] [PackedBy]
[10]       [55]          [3]       [1]
[11]       [66]          [2]       [4]
[12]       [77]          [3]       [4]
[13]       [88]          [2]       [1]

I want the Query to return somthing like

[OID]   [CID]   [TAKER] [PACKER]
[11]    [66]    [Bill]  [Steve]
  • 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-09T20:24:48+00:00Added an answer on June 9, 2026 at 8:24 pm

    If you use different table aliases, you could join the same table more than once.

    For example:

    SELECT
    O.Order_ID AS OID, Customer_ID AS CID, 
       EmpP.UserName AS Packer,
       EmpT.UserName AS Taker
    
    FROM Orders O
    LEFT JOIN Employees EmpP ON Emp.User_ID = O.PackedBy
    LEFT JOIN Employees EmpT ON Emp.User_ID = O.TakenBy
    WHERE O.Customer_ID =3
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does my question make sense? Using either Vim or Emacs, you come to understand
The Question: When you UnicastRemoteObject.exportObject(instance) . Does that instance now become publicly available to
Does anyone know if Python's shelve module uses memory-mapped IO? Maybe that question is
Based on some answers to this question it appears that +alloc does some behind-the-scenes
Simple question: does the Java memory/synchronization model guarantee atomic pointer writes? That is, if
I heard that ASP.net MVC does not maintain View State.So,here is my question I
I understand the problem that OSGI solved thanks to this question.... What does OSGi
Can't find the answer to my question in MSND: Does Timer class guarantees that
When answering another question, I realized that the following program does not quite do
First, let me state that this is a programming question (and thus does not

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.