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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T00:37:26+00:00 2026-06-17T00:37:26+00:00

I need to write a select statement which gathers not only information from multiple

  • 0

I need to write a select statement which gathers not only information from multiple tables, but information from within a certain table which matches data in other rows within that same table.

So while joins would work for the multiple table issue, as far as I am aware I cannot “join” column a and column b in the same table.

Here’s the detail

I have the following tables

CR, VM and Folder

I need to select the following:

ID and Name from CR

Folder Name

Folder name however is not in the folder table, to find it, I need to first take “ID” from CR and match it to “ObjectID” in VM – then the column “Location” in that row matches the ObjectID of another row in the VM table.

I need to then match ID in folder to that ObjectID and retrieve “Name” in the table “Folder” to retrieve the folder name”.

I don’t quite know where to start, should I use cursors for this?

  • 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-17T00:37:27+00:00Added an answer on June 17, 2026 at 12:37 am

    It is possible to join a table against itself by aliasing one side of the join. This may be enough to get you started. Otherwise we would need to see some sample data.

    SELECT
      CR.ID,
      CR.Name,
      Folder.Name AS FolderName
    FROM
      CR
      /* First join CR to VM */
      INNER JOIN VM ON CR.ID = VM.ObjectID
      /* Then join VM to itself aliased as VMLoc, mapping Location to ObjectID */
      INNER JOIN VM AS VMLoc ON VM.Location = VMLoc.ObjectID
      /* Finally join the second ObjectID to Folder to get Folder.Name */
      INNER JOIN Folder ON Folder.ID = VMLoc.ObjectID
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need write an update statement that used multiple tables to determine which rows
I need to write a syntax which uses (single line if) statement, but I
I need to write the following SQL statement in LINQ lambdas : SELECT *
I need to write a script in Matlab, which will read some data from
I need to write a program that accepts a basic SQL select statement and
I try to write a LINQ statement which returns me all possible combinations of
I have this SQL statement which is working fine, but it doesn't satisfy my
Lets say we need to select two sets from a table: Things var GradeA
I need to write a select query for a network diagram. There are two
I have a select statement returning 5 columns: select col1,col2,col3,col4,col5 from table1; col1 col2

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.