0

Never ran into this before. I'd like to do it in SQL, but I can in Excel as a fall-back... It's a relatively small set of data.

Suppose I have the following data:

foo | val
----+-----
 A  | red
 A  | blue
 B  | up
 B  | down

...and I want the result...

foo | agg
----+---------
 A  | red,blue
 B  | up,down

So if I could invent my own aggregate functions, it would be:

select foo
      ,concat(val,',') as agg
from mytable
group by 1

Does anything like this exist? Specifically I'm on Netezza.

Thanks!

Chris
  • 1,421
  • 3
  • 18
  • 31

1 Answers1

0

Check out the thread https://www-304.ibm.com/connections/forums/html/topic?id=a2402d13-1fdc-4e65-b0ad-adbedbe2c9e1 May be it will be of your help. But for single pass query, you have to be sure for possible maximum number of repetition. Or you can have a multi pass query

Roopesh
  • 279
  • 2
  • 7