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
 General SQL Server Forums
 New to SQL Server Programming
 SQL Select

Author  Topic 

joriveek
Starting Member

33 Posts

Posted - 2007-02-08 : 05:06:56

Hi,

I have data as follows:

1 A 10
1 B 4
1 C 2
2 A 15
2 B 5

I want to display the data as follows:

1 A 10 B 4 C 2
2 A 15 B 5

or

even like

1 10 4 2
2 15 5

Group them up the first column to avoid the repeations and give the result in one single line, Is this possible?

Thanks
J




SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-02-08 : 05:12:43
SELECT DISTINCT Col1, dbo.fnConcat(Col1)
FROM YourTable

The Concat function exists in many variations. Please feel free to do a search on this site.


Peter Larsson
Helsingborg, Sweden
Go to Top of Page
   

- Advertisement -