I have a simple query that returns 2 rows as it is joining 2 tables. The query is this:
SELECT
id, fecha, tipo, fuente, origen, estado, gravedad, cliente,
sectores, datos, idInforme, idDepartamento
FROM
Informe I
INNER JOIN
InformeDepartamento ID ON I.ID = ID.idInforme
What I need is only to return a single row with the 'idDepartamento' column merged and separated by commas. So the content is 1,4
How can I accomplish this? I've tried with PIVOT
but it did not work as I think it is not the right approach for this.