Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Aggregate function for strings

Status
Not open for further replies.

ryanxr

Technical User
Mar 29, 2004
4
CA
Hi,

I'm trying to concatenate string values from the same field in different rows. I'd like to do something similar to the sum function with a group by criteria.

For example, if my initial table looks like this:

CASE_ID SUMMARY
------- -------
15001 Text
15002 Text
15003 ABC
15003 DEF
15003 GHI
15004 Text

This should be the result:

CASE_ID SUMMARY
------- -------
15001 Text
15002 Text
15003 ABCDEFGHI
15004 Text

Thanks!
 
This would be a case for a stored procedure that loops through the records and uses a cursor. As long as the next CASE_ID is the same than do a concatenation of the summary value.
Any possible solution with just SQL will become VERY slow with more than just a small dataset....

T. Blom
Information analyst
tbl@shimano-eu.com
 
blom, thanks for the info. it is a big dataset so i'll have to figure out something else. cheers.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top