The aggregate LIST function is very useful however unfortunately currently there is no non-aggregate version.
I frequently concatenate different fields together, but it would be useful to be able to do this separating the result with commas.
I propose a new non-aggregate version of the LIST function, say STRINGLIST. This would concatenate string versions of it's arguments but correctly place commas (so there is no comma at the end of the list).
SELECT STRINGLIST('A','B','C') FROM RDB$DATABASE:
SELECT STRINGLIST('A',NULL,'C') FROM RDB$DATABASE
Example of real-world usage:
SELECT STRINGLIST(ADDRESS_LINE1, ADDRESS_LINE2, CITY, ZIPCODE) FROM...
Currently I do this (which is almost equivalent)
SELECT TRIM(TRAILING ',' FROM COALESCE('A' || ',','') || COALESCE('B' || ',','') || COALESCE('C' || ',','')) FROM RDB$DATABASE
But ideally an empty list would return NULL instead of '', and also the above is slightly dangerous as if the string contains a comma!
I suggest that any such function has an optional argument to decide whether empty list should be null or '', and also the option to quote each element in the list. An option to remove duplicates would be handy similar to the aggregate version.