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 2008 Forums
 Transact-SQL (2008)
 Summarize data from multiple records in table

Author  Topic 

dave.bodenheimer
Starting Member

5 Posts

Posted - 2011-07-08 : 10:37:36
OK, I'm sure this is incredibly simple, but I'm having a brain lock.

I have a table that contains several records for a given case. Here is a sample

Case Item
1 ItemA
1 ItemB
2 ItemA
2 ItemB
2 ItemC
3 ItemA


I need to be able to query this table by case and return a string containing all of the items in that case

So in my example, if I were to query case 1, I would want 'ItemA, ItemB' If I were to query case 2, I would want 'ItemA, ItemB, ItemC'


I'm sure this is really simple and I feel like an idiot asking, but I would really appreciate the help!


Dave

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2011-07-08 : 10:39:26
see this thread http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=81254


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

dave.bodenheimer
Starting Member

5 Posts

Posted - 2011-07-08 : 11:01:22
Thanks! created a udf to handle it. Thanks!
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2011-07-08 : 19:21:01
quote:
Originally posted by dave.bodenheimer

Thanks! created a udf to handle it. Thanks!



Why ? Didn't i refer you to a solution without UDF ?


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page
   

- Advertisement -