This site uses different types of cookies, including analytics and functional cookies (its own and from other sites). To change your cookie settings or find out more, click here. If you continue browsing our website, you accept these cookies.
Having a tough time putting this together. I have these two tables. Is there a way to do this in-db and regular flow.
Table 1:
Task_ID | Resource Name |
1 | Johnny Bravo |
1 | Johnny Bravo |
1 | Joshua Washington |
2 | Teddy Jones |
3 | Samuel Jefferson |
Table 2
Task_ID | Task_ID Name |
1 | Cleaning |
2 | Housekeeping |
3 | Something Else |
Result:
Task_ID | Task_ID Name | Resource Name |
1 | Cleaning | Multiple/Duplicate |
2 | Housekeeping | Teddy Jones |
3 | Something Else | Samuel Jefferson |
OR
Task_ID | Task_ID Name | Resource Name |
1 | Cleaning | Johnny Bravo, Johnny Bravo, Joshua Washington |
2 | Housekeeping | Teddy Jones |
3 | Something Else | Samuel Jefferson |
Hi @SYang1
If you're using In-DB, I assume you'll need to do a few steps:
Summarize Table 1
Group BY Task ID and Concatenate Resource Name with separator ","
Inner Join IN-DB the result of your summarize with Table 2.
Cheers,
How do you concatenate resource name across rows (In-Database)?
I don't see the concatenation option for Summarize in-DB
Hmm maybe this option is not available with IN-DB Summarizing and I'm mistaken.
Why don't you try to write a query in your Connect In-Db with this table?
SELECT ID, STRING_AGG (Resource Name, ',') AS Resource Name FROM Table 1 GROUP BY ID;
OR
SELECT ID, STUFF((SELECT ',' + Resource Namme FROM Table 2 AS T1 WHERE T1.ID = T2.ID FOR XML PATH('')), 1, 1, '') FROM Table 2 AS T2GROUP BY ID;
Then you don't need to do this Summarize step.
Cheers,