0
I want to bring only the last record(last sequence) of a table.
But even using the max
in the column I want, it ends up bringing more results than expected.
select distinct a.vl_recebido
--a.nr_sequencia
,b.vl_lancamento
,b.nr_sequencia
,max(b.nr_seq_baixa)
,a.dt_recebimento
,a.dt_recebimento
FROM TITULO_RECEBER_LIQ a
JOIN pls_titulo_rec_liq_mens b on (a.nr_titulo = b.nr_titulo)
where a.nr_titulo = 407616
and a.vl_recebido <> '0,00'
--and a.nr_sequencia = 4
--and b.nr_seq_baixa = 4
--and a.dt_recebimento = (select max(a.dt_recebimento) from titulo_receber_liq a)
group by a.nr_sequencia, a.vl_recebido, a.dt_recebimento, b.vl_lancamento, a.dt_recebimento, b.nr_sequencia, b.nr_seq_baixa
Hello Douglas, So the two options returned errors. I will try to attach here. Another thing, is that I need to do this in the nr_seq_low field.
– Luiz Fernando
The first returned error no limit, and the second returned that did not locate the word from
– Luiz Fernando
It’s hard to know what’s wrong without having a table to know, but I edited it, see now
– Douglas Teles