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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T14:59:57+00:00 2026-06-04T14:59:57+00:00

I am having trouble with this query. I have read quite a few things

  • 0

I am having trouble with this query. I have read quite a few things but have yet to find a solution. The problem is with the subquery- it really doesn’t like it. Can someone help me get this to work?

The first table represents a Work Performed table and the second talbe shows Employee Information. I am basically trying to get a supervisor name for an employee using the ‘position_reports_to’ field which is an HR code. By the way, this is in Teradata.

Thanks!

select
t1.record_number,
T1.record_created_by,
T2.last_name,
T2.first_name,
T2.employee_no,
t2.position_number,
T2.position_reports_to as SUPID,
(select last_name from T2 where SID=T2.position_nbr) as SUP
from T1
left join T2 on T1.record_created_by=T2.employee_no
where
t1.record_create_date=current_date
  • 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-04T14:59:58+00:00Added an answer on June 4, 2026 at 2:59 pm

    You can try another LEFT JOIN instead of the subquery:

    SELECT
       t1.record_number,
       T1.record_created_by,
       T2.last_name,
       T2.first_name,
       T2.employee_no,
       t2.position_number,
       T2.position_reports_to AS SUPID,
       sup.last_name AS sup_last_name
    FROM T1
    LEFT JOIN T2 ON T1.record_created_by=T2.employee_no
    LEFT JOIN T2 sup ON sup.SID=T2.position_nbr
    WHERE t1.record_create_date=current_date
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am having trouble with the query in this code. The problem is one
I am having trouble with this query but ONLY under HSQLDB. We use Oracle
I am having trouble figuring out how to even start this query. I have
I'm having some trouble with a linq query. It's a simple problem, but I'm
This query works fine but I'm having trouble trying to figure out why it
I'm having trouble with this query. I have 2 date coming from textboxes (don't
I'm having trouble writing this Query. I have 2 tables, vote_table and click_table. in
I'm having trouble figuring out the solution to this SQL query. Schema Edit :
I`m having trouble trying to optimize this query with OVER (PARTITION BY ...) because
I'm having trouble getting any information to display from this query. Anyone know where

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.