Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2012
    Posts
    2

    Unanswered: Retrieving names from multiple user IDs in one record

    I have what I hope is a simple question (I'm relatively new to SQL and databases in general, so forgive me if this is a stupid question).

    I'm working with an ActivityLog table that contains three user ID fields (AnalystID, ReviewerID, and ManagerID). I want to retrieve the full name of each of these users from a Users table. What I'm trying to figure out is how to setup a query to retrieve more than just one of the names. The query to retrieve the AnalystID by itself looks like this:

    SELECT Users.FullName
    FROM ActivityLog INNER JOIN Users ON ActivityLog.AnalystID = Users.ID

    However, I want the query to contain three different Users.Fullname fields, with each corresponding with one of the three user ID fields. Is it possible to do this?
    Last edited by kefka95; 09-15-12 at 11:39.

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    yes, it's possible

    just yesterday we had an almost identical request, see if you can adapt the solution...

    http://www.dbforums.com/mysql/168516...same-name.html
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Sep 2012
    Posts
    2
    Quote Originally Posted by r937 View Post
    yes, it's possible

    just yesterday we had an almost identical request, see if you can adapt the solution...

    http://www.dbforums.com/mysql/168516...same-name.html
    Thanks much, that did the trick (you're right, they were very similar questions!).

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •