2
I have the following query:
SELECT finempe.data_empenho
, finempe.num_empenho
, finhisem.quantidade
, finhisem.historico
, finhisem.valor
, finhisem.valor_total
FROM finempe
RIGHT JOIN finhisem ON
(finhisem.num_empenho = finempe.num_empenho)
WHERE finempe.data_empenho between '01-01-2002' and '31-12-2002' and finempe.valor_empenhado != finempe.valor_anulado and finempe.codigo_tipo = 1 and finhisem.codigo_tipo = 1 and conta_desp = 31900100 and finhisem.ano_empenho = 2002
ORDER BY finempe.num_empenho, finhisem.num_seq
I want to group the lines, but concatenating the field historical (I imagine doing a SUM on value and total value and a concatenation on historical)
Example grouping row 5, 6 and 7:
"2002-01-02" "45" "10000" "Provision of p/pagto resources. complementary to retired servers linked to FUNCAPI, p/ the period from January to December/2002" "540000" "540000"
that is, keep all values and concatenate the history
Hello! What have you tried to do so far?
– Dherik
Complete the question by telling which fields you want to group. Put an example of how the expected result would be and also put some attempt you have already made and did not work as expected.
– Pagotti
What you want to concatenate in the historical field?
– Wellington Araujo
@Wellingtonaraujo I want to concatenate the historical field of line 1 with line 2 and keep the rest as if it were a group by
– V.Avancini