I have the following query:
SELECT e.id_taxe, u.nm_user, dt_taxe, SUM(e.vl_taxe) as vl_taxe
FROM taxe as e
INNER JOIN user as u ON u.id_user = e.id_user
WHERE id_enterprise = 86 AND (dt_taxe BETWEEN '2017-01-01' AND '2017-03-31')
AND lg_cancel = 0 GROUP BY e.dt_taxe, e.id_user ORDER BY e.id_user,e.dt_taxe
That returns me:
id_taxe nm_user dt_taxe vl_taxe
728 Maria 2017-01-01 17091.07048034668
727 Maria 2017-02-01 14091.07048034668
721 Maria 2017-03-01 1021.07048034668
731 Pedro 2017-01-01 16353.569854736328
732 Pedro 2017-02-01 6353.56231239
How can I concatenate the same user's fields on the same line, to have the following result:
id_taxe nm_user dt_taxe vl_taxe
728 Maria 2017-01-01 17091.07048034668 ,
2017-02-01 14091.07048034668,
2017-03-01 1021.07048034668
731 Pedro 2017-01-01 16353.569854736328,
2017-02-01 6353.56231239