0
I need to return the last record of a table that is on JOIN
of my consultation.
But my knowledge is limited and I can’t go on:
My consultation
SELECT s.id_servico,
s.titulo,
s.valor,
st.situacao,
st.id_situacao
FROM servicos s
JOIN (SELECT id_servico,
Max(id_situacao) AS id_situacao,
situacao
FROM situacao
GROUP BY 1) st
ON st.id_servico = s.id_servico
WHERE s.id_servico = 2872
Using order by for service id does not resolve?
– hh22
No. Returns the same thing.. the maximum id_situation, but the value (situation) is not the corresponding
– Gabriel