0

Example table:

id      some_column
1        value1
2        value2
2        value3
3        value4
1        value5

Expected result:

id some_column
1  value1, value5
2  value2, value3
3  value4

I tried select id, concat(some_column) from table_name group by id

It says concat does not exist or permission denied...

xavi
  • 29
  • 1
  • 1
  • 8
  • @a_horse_with_no_name I want to use concat function. Why to install separate library. Concat exist in vertica if manually check. I just got the error. Am referring to correct the error or find the cause of it. – xavi May 03 '16 at 13:48
  • `concat()` is not an aggregate function. –  May 03 '16 at 13:51
  • it is: check `select CONCAT('this', ' YES')` – xavi May 03 '16 at 13:52
  • And https://github.com/vertica/Vertica-Extension-Packages/tree/master/strings_package how to install this. My Vertia SQL workbench is in Windows, and this readme doesnt guide how to integrate in existing one. Also how to use group_concat for the above example I mentioned? – xavi May 03 '16 at 13:53
  • That's concatenation, not aggregation. Aggregation is e.g. `sum()`, or `avg()`. `concat()` is ***not*** an _aggregate_ function. –  May 03 '16 at 13:54
  • ok got it. So what is aggregation function for my case. I would prefer easiest one like SUM. Just one word function. – xavi May 03 '16 at 14:00
  • See more options using leg and lead functiin her https://community.dev.hpe.com/t5/Vertica-Forum/Combine-Multiple-ROWS-into-single-row/td-p/222505/highlight/true/page/2 – elirevach May 03 '16 at 20:13
  • @elirevach Well lead function is like manually writing all column values. Then will group them. Whats the use if it can't select values from column automatically and aggregate? – xavi May 06 '16 at 15:09

0 Answers0