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 8612201
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T04:34:07+00:00 2026-06-12T04:34:07+00:00

I have 4 fields that I need -> USERID LOCATION REPORT_MGR_USERID (reporting manager user

  • 0

I have 4 fields that I need ->

  1. USERID
  2. LOCATION
  3. REPORT_MGR_USERID (reporting manager user ID)
  4. Manager Location (this is not actually stored)

To get the 4th one, I need to build it using SQL. I can do this via the “USERID” and “LOCATION” fields.

Here is my attempt. I am running a query within Access 2007, via a linked DB2 table.

SELECT DISTINCT employee_table.LOCATION, employee_table.USERID, employee_table.REPORT_MGR_USERID,  manager_location 
FROM employee_table main
JOIN  employee_table (SELECT DISTINCT employee_table.LOCATION FROM employee_table AS sub WHERE sub.USERID = main.REPORT_MGR_USERID) manager_location

When I run it, it’s giving me this error ->

Syntax error in FROM clause

and then highlights the JOIN keyword.

This looks correct from everything I’ve looked at….

EDIT:

Thanks to David W, this is the working version for future reference ->

SELECT DISTINCT main.LOCATION, main.USERID, main.REPORT_MGR_USERID,  manager_data.LOCATION 
FROM employee_table main
INNER JOIN employee_table manager_data
ON main.REPORT_MGR_USERID=manager_data.USERID
  • 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-12T04:34:08+00:00Added an answer on June 12, 2026 at 4:34 am

    You are specifying both a table name employee_table and a subselect (SELECT DISTINCT....) in the first JOIN clause. And there’s no ON condition, although that may be what you want?

    The specification of employee_table in that JOIN might just be a typo, since you’ve provided an alias for the subselect…

    Edit The light bulb just went on and I understand what the OP wants. Here we go:

    SELECT DISTINCT main.LOCATION, main.USERID, main.REPORT_MGR_USERID, manager_data.manager_location 
       FROM employee_table main
       INNER JOIN employee_table manager_data
         on main.REPORT_MGR_USERID=manager_data.USERID
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two fields that need to multiply each other and fill a third
I currently have a SQL query that returns a number of fields. I need
I need to ensure that a given field does not have more than one
I have a form that has a group of 3 text_fields. I need two
I have a database table with a field that I need to read from
I have a field that may be blank, so I need to use Object.try,
Given a table in MySQL with rows that have a 'Country' field, I need
I have some documents in couchdb that have fields that are arrays of id's
In SQL its possible to have fields that cannot contain duplicate data. How is
I have three fields that must be unique in a table, and based on

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.