Hi,
I am trouble in writing and SQL that returns the result of an SQL as a concatenated single string. Is there an aggregate grouping function on string in DB2?
Ex:
Table: Employee
FirstName LastName Address
John Smith 123 Smith St
Barry Gray 123 Gray St
SQL: Select FirstName from Employee
This returns all the rows in the Employee table with just the FirstName Column. Instead of multiple rows, I want to return just one string with all the values of the rows concatenated and seperated by ",". Can this be done in DB2 procedure or SQL?
Desired Result: "John, Barry"
Thanks in advance
ykc
I am trouble in writing and SQL that returns the result of an SQL as a concatenated single string. Is there an aggregate grouping function on string in DB2?
Ex:
Table: Employee
FirstName LastName Address
John Smith 123 Smith St
Barry Gray 123 Gray St
SQL: Select FirstName from Employee
This returns all the rows in the Employee table with just the FirstName Column. Instead of multiple rows, I want to return just one string with all the values of the rows concatenated and seperated by ",". Can this be done in DB2 procedure or SQL?
Desired Result: "John, Barry"
Thanks in advance
ykc