469,950 Members | 2,067 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,950 developers. It's quick & easy.

Help with combining data from multiple rows into one column in a view

Hi, I am stumped and was hoping someone could help me out. Any help is
appreciated.
I have a view that looks sort of like this (but with a lot more
entries of course)
UniqueIdentifyier Column1 Column2
1 9999 100
2 9999 200
3 9999 300
What I want to do is to add a column to the view that will contain a
list of the values from column 2 where column 1 is the same.

UniqueIdentifyier Column1 Column2 Column3
1 9999 100 100, 200, 300
2 9999 200 100, 200, 300
3 9999 300 100, 200, 300

Jul 19 '07 #1
1 3113
(ga******@comcast.net) writes:
Hi, I am stumped and was hoping someone could help me out. Any help is
appreciated.
I have a view that looks sort of like this (but with a lot more
entries of course)
UniqueIdentifyier Column1 Column2
1 9999 100
2 9999 200
3 9999 300
What I want to do is to add a column to the view that will contain a
list of the values from column 2 where column 1 is the same.

UniqueIdentifyier Column1 Column2 Column3
1 9999 100 100, 200, 300
2 9999 200 100, 200, 300
3 9999 300 100, 200, 300
This may not be doable in a view, particularly if you are on SQL 2000.

SQL Server MVP Anith Sen has a collection of methods to attack this
problem at http://www.projectdmx.com/tsql/rowconcatenate.aspx.
--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
Jul 19 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

15 posts views Thread by Jay | last post: by
6 posts views Thread by insirawali | last post: by
2 posts views Thread by yeshello54 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.