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 2008 Forums
 Transact-SQL (2008)
 problem with INNER JOIN

Author  Topic 

dmaxj
Posting Yak Master

174 Posts

Posted - 2011-01-21 : 12:14:05
I have a table A with a primary key. I have a related table B with multiple foreign keys from table A. Code follows:

SELECT pk_ID, fk_ID field1, field2
FROM table A INNER JOIN table B ON
A.pk_ID = B.fk_ID

This returns all matches in B where A exist.

Is there a way to only return the latter of the 2 or more records that exist in table B instead of all of the matches in table B ?

Regards

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-01-24 : 11:31:17
not quite clear what you're looking at
can you post data sample and explain what you want?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -