Have a stream column ID and Account numbers, would like to concatenate the Account# as comma separated list in one row.
Below is the query in SQL which creates the comma separated list with group by clause. (copy pasted from https://www.peteonsoftware.com/index.php/2009/12/11/creating-a-comma-separated-list-from-a-sql-grouping/)
SELECT e.EmployeeId, e.FirstName, e.LastName,
STUFF((SELECT ',' + COALESCE(LTRIM(RTRIM(t.TerritoryDescription)), '')
FROM EmployeeTerritories et
INNER JOIN Territories t on et.TerritoryID = t.TerritoryID
WHERE et.EmployeeID = e.EmployeeId
FOR XML PATH('') ), 1, 1, '') as TerritoryList
FROM Employees e
Is it possible to achieve in KSQL?
Please note the kafka connector is configured for the data source, and don't have much control on the source.
question from:
https://stackoverflow.com/questions/66065887/ksql-transform-rows-to-column-with-group-by 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…