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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T11:07:42+00:00 2026-06-13T11:07:42+00:00

I have a table( T1 ) in which 2 columns( X and Y )

  • 0

I have a table(T1) in which 2 columns(X and Y) are id’s. The name’s of these corresponding id‘s are in another table (T2) with the column name.

Suppose I was only using X then, a simple Inner join would have solved my problem in getting the name.

Such as

Select T1.somedata,T1.somedata1,T2.name from T1
Inner Join T2 ON T1.X=T2.id

But,what if I want the name’s to be resolved for the T1.Y also?, which name would the Inner Join resolve it to ??

Select T1.somedata,T1.somedata1,T2.name from T1
Inner Join T2 ON T1.X=T2.id
Inner Join T2 ON T1.Y=T2.id

The above query is wrong, I know. Can I get the names of those corresponding to both T1.Xand T1.Y with an INNER Join?

-Beginner

  • 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-13T11:07:42+00:00Added an answer on June 13, 2026 at 11:07 am

    I suggest always add aliases to tables and columns. So you will be sure which data are selected.

    select
        T1.somedata,
        T1.somedata1,
        T2X.name as XName,
        T2Y.name as YName
    from T1 as T1
        inner join T2 as T2X on T2X.id = T1.X
        inner join T2 as T2Y on T2Y.id = T1.Y
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

lets say we have a table BNK_ACCT_GRP_ST with these columns: Column Name ID Pk
I have a picture table which consists for users pictures Table Name:picture Columns: picture_id
Suppose I have a table called 'test', into which there are three columns named
I have a table name Overtime Hours which have the following columns Ot_ID, Shift_Date,
i have one table which consists of 10 columns out of which one column
I have two or more tables which hold values under the same column name.
I have a mysql table which columns are post_id and post_msg. Now I want
if i have a table which has columns with fixed lenght, Will mySQL count
I have a SQL table in which some columns, when viewed in SQL Server
I have a table which consists of a few columns, including a Key Value

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.