I am using SQL Server 2014.
I have made a a sqlFiddle
This is my current query. I have tried to group by id and category and use the stuff function to concat identifictaion_number
but still can't get the right result. Let me know if additional information is needed.
SELECT
t1.id, t2.identification_number, t3.description AS 'category'
FROM
table1 t1
JOIN
table2 t2 ON t2.wuID = t1.id
JOIN
lookupTable3 t3 ON t3.id = t2.itID
Current output:
id identification_number category
-----------------------------------
100 123 cat1
100 345 cat2
100 567 cat2
101 9899 cat2
Desired output:
id identification_number category
-----------------------------------
100 123 cat1
100 345, 567 cat2
101 9899 cat2