holdemfoldem
Programmer
To get the sum of a given column for a group of rows sharing the same column value, you do the following:
SELECT ccustno,
sum(nbalance) as totalbalance
FROM arinvc
GROUP BY ccustno
My question: How do you concatenate the string values of a given column for a group of rows? I know you can concantenate strings with the "+" or "||" operator, but this works only for different columns of the same row and is not what I need.
In my case, I have several rows for the same item in an inventory table, say a Compaq PC Model 12345, each of which contains a description column. The first row may contain "128 meg Ram" in the description column, the next row may contain "40x CD", etc, and I need to combine these into a single description field to go with single row for that computer, resulting in something like:
Compaq PC Model 12345 128 meg Ram, 40x CD, etc
Thanks ahead for help!
SELECT ccustno,
sum(nbalance) as totalbalance
FROM arinvc
GROUP BY ccustno
My question: How do you concatenate the string values of a given column for a group of rows? I know you can concantenate strings with the "+" or "||" operator, but this works only for different columns of the same row and is not what I need.
In my case, I have several rows for the same item in an inventory table, say a Compaq PC Model 12345, each of which contains a description column. The first row may contain "128 meg Ram" in the description column, the next row may contain "40x CD", etc, and I need to combine these into a single description field to go with single row for that computer, resulting in something like:
Compaq PC Model 12345 128 meg Ram, 40x CD, etc
Thanks ahead for help!