How can I concatenate rows in select query? (in Advantage Data Architect)
I tried run the following scripts:
The first script:
declare @str string;
set @str = '';
select @str = @str + field_1 from my_table1
But I get a result where all rows contain "false", like this picture:
Second script:
declare @str string;
select @str = coalesce(@str + ', ','') + field_1 from my_table1
This time, all rows are empty (note: the field from "my_table1" is not null).
Picture:
I tried to search the solution on the Internet for Advantage Data Architect, but I could not find a solution.
I'm assuming you want something like
GROUP_CONCAT
in MySQL orstring_agg
in Oracle / Postgres.The general algorithm for that is something like:
A general function can be found on the ADS forum.
PS: This is the reverse of splitting a string into separate rows.