0
SELECT DadosFinanceirosFiliado_Valor,
Filiados_Filiado_Id,
DadosFinanceirosFiliado_CompetenciaMes,
DadosFinanceirosFiliado_CompetenciaAno
FROM dadosfinanceirosfiliado t
INNER JOIN filiados
ON dadosfinanceirosfiliado.Filiados_Filiado_Id = filiados.Filiado_Id
WHERE t.DadosFinanceirosFiliado_Valor(SELECT Filiados_Filiado_Id
FROM dadosfinanceirosfiliado
WHERE DadosFinanceirosFiliado_Valor = t.DadosFinanceirosFiliado_Valor
ORDER BY DadosFinanceirosFiliado_CompetenciaMes, DadosFinanceirosFiliado_CompetenciaAno DESC LIMIT 0, 1)
I’m having a hard time putting together my consultation, I wanted to know how to assemble a select to bring the last value of a table based on month and year (the most I could get was in the sql shown above).
if you use the MAX(Data) function it searches for the last date value.
– Bruno
But beyond the month has the year also friend, as it would work better has some example ??
– Vision Development
I think it would be easier if you showed some example of the two tables you linked before. Why Inner Join exists if you have no condition linked to this table?
– Bruno
pq the column Affiliate_affiliate_id comes from another table it and an index
– Vision Development