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

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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T20:52:21+00:00 2026-06-16T20:52:21+00:00

I have two tables: Names – id (int) – name (string) and Relationships –

  • 0

I have two tables:

Names
- id (int)
- name (string)

and

Relationships
- id1 (int)
- id2 (int)

I want to query a list of all relationships that have certain id1, and I want to include the names from Names in the resulting query.

So, the result would have four columns

  • id1
  • id2
  • name_for_id1
  • name_for_id2

Is this possible? I know I can do an inner join to include one of the names, but I am not sure how to include both names.

For one name I would do something like:

select Relationships.id1, Relationships.id2, Names.name from Relationships
inner join Names
on Names.id1 = Relationships.id1
  • 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-16T20:52:22+00:00Added an answer on June 16, 2026 at 8:52 pm

    You can join a table twice.

    SELECT
       r.id1,
       r.id2,
       n1.name,
       n2.name
    FROM Relationships r
    INNER JOIN Names n1 ON r.id1 = n1.id
    INNER JOIN Names n2 ON r.id2 = n2.id
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two tables. indRailType contains a list of the names paired with an
I have two tables. Table A has a list of employee names. Table B
I have two tables that are similar. Table word column names: id, name, describe
So I have two Tables. The first are Names and their qualifications: Users: Name
I have two tables in MS Access. Table 1: users ID (auto int) Name
Assuming that I have two tables, names and phones , and I want to
I have two tables with city names in them. I want to check the
I have two tables names book_list and book_category . Schema is like below: book_list
I have two tables people name id man1 456 man2 123 man3 789 notes
I have two tables people name id man1 456 man2 123 man3 789 notes

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.