0
I have the following consultation:
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
Who returns to 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 fields of the same user 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
Bia, conceptually you have 3 records with distinct id_taxe, Note that your id_taxe in the example was fixed at 728, and Maria has others (727 e 721)
– Najib El Alam
@Najibelalam actually id does not matter to me, only date and value
– Bia