Group Concat equivalent?

joebananas

New Member
Can anyone tell me how to perform the equivalent of a Group Concat function in Progress SQL? I want to get a concatenation of multiple records into a single record.

For example, this SQL produces a set of data

SELECT data1 FROM table1 WHERE data2=True

Code:
+-------+
| data1 |
+-------+
| somet |
| hing  |
| like  |
| this  |
+-------+

Using a GroupConCat function I can get this,

SELECT GroupConcat(data1) FROM table1 WHERE data2=True

Code:
+---------------------+
|        data1        |
+---------------------+
| something like this |
+---------------------+

Any help would be appreciated
 
To get a full overview of what can and can;t be done with sql read the following documentsmight help:
sql reference: http://communities.progress.com/pcom/docs/DOC-16285
sql development: http://communities.progress.com/pcom/docs/DOC-16286

Back to your question: The only function in SQL92 I know is concat, which concatenates string values. And since I am not very much using SQL I think I may ask a stupid question:

What is the use of concatenating data from several records into 1? It seems illogical for me from a relational database POV. But then again it might be that this is a stupid question.

Regards,

Casper.
 
Thanks for the response, Casper.

The database I'm working with has stupid way of handling large amounts of text. In their UI they have a Comments field where the user can enter as much text as they'd like but the data is stored in another table as multiple records with only 50 characters in each record. So if the user decides to write a novel in the comments field then there may be hundreds of records used to store it.

Now I have a SELECT statement that needs to get all the information for this record, including the comments but I can't think of any other way to read it all with a single SELECT statement but with a Group Concat. And I can't change the way the existing app saves and reads it's data.

Any ideas?
 
Back
Top