ow To Fetch The Data Of Parent Table By Using List Of Child table ForiegnKeyId SQL Query [Resolved]

Posted by Kasani007 under Sql Server on 5/4/2016 | Points: 10 | Views : 1391 | Status : [Member] | Replies : 2
SQL Query, To How To Fetch The Data Of Parent Table By Using List Of Child table ForiegnKeyId

select * from Parent Where (select* from Child where kid=20)


pls help me




Responses

Posted by: A2H on: 5/4/2016 [Member] [MVP] Silver | Points: 50

Up
0
Down

Resolved
You can use InnerJoin to fetch results from tables based on conditions

SELECT *
FROM ParentTable PT
INNER JOIN Child CT ON CT.FKColumnName = PT.PKColumnName


Thanks,
A2H
My Blog

Kasani007, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Professionaluser on: 5/4/2016 [Member] [MVP] Bronze | Points: 25

Up
0
Down
SELECT * 
FROM ParentTable
WHERE PKColumnName in (SELECT FKColumnName FROM ChildTable)


Kasani007, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response