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)
 Many records to one result record

Author  Topic 

frank2
Starting Member

35 Posts

Posted - 2005-06-07 : 10:25:15
I have a relate table called “Pairs” with the structure:
Primary key
FK_Name_source
FK_Name_Ref

I have another table called “Names” with the structure:
Primary key
Name

How can I write a select statement that will return a result set having this structure:
FK_ Pairs - Primary key from Pairs
Name_source – The name from the Names table where Names.Primary Key = Pairs.FK_Name_source
Name_Ref – The name from the Names table where Names.Primary Key = Pairs.FK_Name_Ref

In essence I need to return information from many records into one record in the result set.

Thanks for the help,
Kirk

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2005-06-07 : 10:46:11
can you post your create table statemnts?
and some sample data and desired resluts based on the sample data?
and how do you want the one result record? in CSV? some other form??

Go with the flow & have fun! Else fight the flow
Go to Top of Page
   

- Advertisement -