Contoh query di SQL server untuk concat string di tabel one-to-many
[code language=”sql”]
select b.program_name, b.status,
STUFF((
SELECT ‘ ‘ + department
FROM order_assigned_departement
WHERE (order_assigned_departement.order_id = b.id)
FOR XML PATH (”))
, 1, 1, ”) AS department, b.submitted_date, group_id
from [order] b
where year(submitted_date) = 2017 and month(submitted_date) = 10 and b.cancellation_status is null
order by b.program_name
[/code]