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.
| Author |
Topic |
|
ramana_cr
Starting Member
14 Posts |
Posted - 2002-01-22 : 11:28:39
|
| Hi, Can you please help me with this problemtablecol1 col21 'AB'1 'CD'How can i get the record 1, 'AB, CD' ( Something like select col1, sum(col2) from table group by col1-- if col2 was number) |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2002-01-22 : 11:44:01
|
| look at the article on creating csv strings.declare @s varchar(1000)select @s = coalesce(@s + ',','') + bfrom tblwhere a = 1select 1, @s==========================================Cursors are useful if you don't know sql.Beer is not cold and it isn't fizzy.Edited by - nr on 01/22/2002 11:45:39 |
 |
|
|
ramana_cr
Starting Member
14 Posts |
Posted - 2002-01-22 : 11:49:13
|
| nr, Thanks... Is there anyway we can do it With a Select statement. I am trying to create a view... |
 |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2002-01-22 : 12:24:04
|
| Read this and the links inside it:http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=12149They're about the best you can do; I don't believe you can do this in a view though, because it will require multiple passes to consolidate the rows into one. |
 |
|
|
|
|
|