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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T15:09:54+00:00 2026-06-05T15:09:54+00:00

I have two tables one with ID and NAME table 1 ID | NAME

  • 0

I have two tables one with ID and NAME

table 1

ID | NAME
1  | first
2  | second
3  | third

and an XREF table with ID and PARENT ID

table2

ID | PARENT ID
1  | 0
2  | 1
3  | 2

and I would like to retrieve the NAME twice like this: NAME | PARENT NAME

If it is possible to go three levels deep but with same 2-column table like this:

result table

NAME   | PARENT NAME
first  | NULL or EMPTY or this line the not showing at all
second | first
third  | second

… then I’d like to figure that out as well.

  • 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-05T15:09:55+00:00Added an answer on June 5, 2026 at 3:09 pm
    select t1.Name, t12.Name from
    table1 t1 
    inner join table2 t2 on t1.ID = t2.ID 
    inner join table1 t12 on t2.ParentID = t12.ID
    

    This would only return 2 rows. If you want to have the first row (for ID=1) you just need to outer join instead.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two tables. First one: create table history ( id integer primary key,
I have two tables made in access. One table (Owner) contains: ownerID , name
I have two tables, the first table has the product and the second table
I have two tables, one Company and one Employee: class Company(models.Model): name = models.CharField(max_length=60)
I have two tables : one table it matchs and the other is teams.
I have two tables, one is a table of forum threads. It has a
I have two tables with this structure: Table one: ID Description Table two: ID
General case: first table represents one -side, second table represents many -side. Third table
I have two tables that I would like to display as a single result,
I have two tables in my database. The first one, [nodeActivity] has the following

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.