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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T00:22:57+00:00 2026-06-05T00:22:57+00:00

i need to query a self referencing relationship for unit prerequisites. i know that

  • 0

i need to query a self referencing relationship for unit prerequisites.

i know that you need to use two Joins, do i SELECT my column and then join it to itself ?

SELECT u.unit_code,
   u.name + ' is a prerequisite of ' + u.name AS unit_prerequisite

FROM units AS u

so far that is what i have, not sure where my joins have to be made? not even sure if that first part is correct.

  • 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-05T00:22:58+00:00Added an answer on June 5, 2026 at 12:22 am

    You do this by joining the table to itself on the self-referencing column:

    SELECT 
        u.unit_code, 
        u1.name + ' is a prerequisite of ' + u2.name AS unit_prerequisite 
    FROM 
        units AS u1
        inner join units u2 on u2.RefId = u1.RefId 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need a query that will return a table where each column is the
I have a method that calls two other methods in it. def main_method(self, query):
I need to query my DB based on a range of two values which
I have a relatively complex query, with several self joins, which works on a
I have a self-referencing table (Customers) and a table that will link to one
I have a table which has self relationship: id -- parentId columns I need
I need select rows with django orm. I need equivalent of such query select
Need to query my SQL server from Access using an ADO connection (for example),
I need to query the number of distinct items in a particular SQLite table
I need a query to Count distinct results... My Table ID | stats |

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.