Does hsqldb provide a function similar to listagg?
hsqldb, oracle
Solution
`group_concat` is probably what you are looking for:
http://www.hsqldb.org/doc/2.0/guide/dataaccess-chapt.html#dac_aggregate_funcs
Quote from the manual:
GROUP_CONCAT is a specialised function derived from ARRAY_AGG. This function computes the array in the same way as ARRAY_AGG, removes all the NULL elements, then returns a string that is a concatenation of the elements of the array
Problem
I am looking for a function (or a group of functions) in HSQLDB that does something similar to Oracle's LISTAGG. I have this as part of a larger select and would like to keep the syntax as similar as possible in HSQLDB: ``` SELECT LISTAGG(owner_nm, ', ') WITHIN GROUP (ORDER BY owner_nm) FROM OWNERSHIP WHERE FK_BIZ_ID = BIZ.BIZ_DATA_ID) AS CURRENT_OWNER ``` The point of this is that we're trying to use HSQLDB for remote work and Oracle for working on site, prod, etc so I want to change the DDLs as little as possible to achieve that. Looking at ARRAY_AGG, it doesn't seem like it does anything similar (as far as being able to pull from a separate table like we're doing above with OWNERSHIP). Any suggestions for how I may accomplish this?