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 2000 Forums
 Transact-SQL (2000)
 Select distinct foreign key

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2005-12-20 : 07:54:36
Eric writes "I have a table in which foreign keys can be repeated many times. I only want to select one row representing each foreign key value in table. I want to basically SELECT DISTINCT on a foreign key field. Is this possible?"

SamC
White Water Yakist

3467 Posts

Posted - 2005-12-20 : 08:34:41
SELECT DISTINCT MyFK -- should do it.
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-12-20 : 08:50:10
SELECT DISTINCT MyFK from ForeignKeysTable

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -