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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T06:35:54+00:00 2026-05-13T06:35:54+00:00

I want to inner join with a child table based on ID and get

  • 0

I want to inner join with a child table based on ID and get the top Row of the child table,
I am not joining to take any data out of the child table, its just to validate that child table record exists for parent table.
If I dont include TOP row there is chances of getting multiple rows of parent in the result set.

— Chances of multiple rows in resultset for same PARENTID is possible

SELECT P.PARENTID FROM PARENT P
INNER JOIN CHILD C ON C.PARENTID =
P.PARENTID and C.ISACTIVE = 1

I need something like

SELECT P.PARENTID FROM PARENT P
INNER JOIN (SELECT TOP 1 * FROM CHILD ) AS C
ON C.PARENTID = P.PARENTID
AND C.ISACTIVE = 1

I not sure how to get it working
I am curious if somebody can help me out or provide me any url where I could find the solution

  • 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-13T06:35:55+00:00Added an answer on May 13, 2026 at 6:35 am

    Do you think WHERE EXISTS will do the job ?

    SELECT P.PARENTID FROM PARENT P 
    WHERE EXISTS (SELECT 1  FROM CHILD C 
    WHERE C.PARENTID = P.PARENTID 
    AND C.ISACTIVE = 1)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Given two collections A & B, I want to output: 1. their inner join
I want to pivot and join to select from 3 tables Table 1: INT,VARCHAR,FLOAT
Current query SELECT * FROM employee AS E INNER JOIN credential AS C ON
I have this database query SELECT * FROM (`metadata` im) INNER JOIN `content` ic
i want to arrange the output of my data in descending Here is my
I want to count the number of interface down and up and write this
I want to know if it is possible to create another column in a
When i run a select after a number of joins on my table I
DB2 database. A Request can have multiple Transactions. I'd like to query the request
How would I write this query using MetaWhere (in Rails 3)? SELECT users.* FROM

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.