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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T23:16:29+00:00 2026-05-18T23:16:29+00:00

I have a parent table and a child table related to the parent table

  • 0

I have a parent table and a child table related to the parent table by some REFERENCE.

Suppose I exec a SELECT statement on the child and that it returns the at least one result. Can I arrange for my search to automatically yield all the content of all related parents with this child too?

Or must I always take the reference from the child and put this in a second SELECT statement and exec this myself?

  • 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-05-18T23:16:30+00:00Added an answer on May 18, 2026 at 11:16 pm

    You can use subqueries:

    SELECT *
    FROM Parent
    WHERE Parent.Id IN (SELECT ParentId
                        FROM Child
                        WHERE Whatever_was_your_original_query)
    

    Or a good old join:

    SELECT Parent.*
    FROM Parent INNER JOIN Child ON Parent.Id = Child.ParentId
    WHERE Whatever_you_want_to_query
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If I have a Parent and Child table in MySQL related by a foreign
I have two linqTOsql entities that has a parent and child relationship, one to
i have a parent child table such that class Service( models.Model ): id =
I have a database table that holds parent and child records much like a
If I have a parent table and a child table where there can be
I have a simple parent/child tables. Contract is the parent table. Each contract can
I have db table with parent child relationship as: NodeId NodeName ParentId ------------------------------ 1
I have a table with two child tables. For each record in the parent
I have a table which defines a child-parent relationship between nodes: CREATE TABLE node
Lets say I have two tables - child and parent with many-to-one relation. What

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.