Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Select various information

Author  Topic 

shapper
Constraint Violating Yak Guru

450 Posts

Posted - 2007-03-20 : 13:26:52
Hello,

I have a table named Posts. Then I have other 3 tables named Docs, Ratings and Reviews. In these 3 tables I have FKs which are the PK of table Posts (PostId).

So for each Post (with given PostId) in Posts I have multiple Docs, Ratings and Reviews.

1. How can I select a Post with given PostId and all its Docs, Ratings and Reviews?
2. And how is that usually received in my .Net code?
I suppose I will get more then one level table.

Thanks,
Miguel

blindman
Master Smack Fu Yak Hacker

2365 Posts

Posted - 2007-03-20 : 14:01:21
You'll need to return Docs, Ratings, and Reviews as three distinct recordsets, or you will end up performing the equivalent of a cartesian join if you link them all to Posts in the same query statement.

e4 d5 xd5 Nf6
Go to Top of Page
   

- Advertisement -