I need to make this join of the sales table with the Nfe table, but the NFE table can have more than one result which causes a change in total sales, how can I change this join to get only the last note? p>
select
sum(total_venda) as total_venda
from vendas v
LEFT OUTER JOIN nfe n ON (v.cod_venda = n.cod_venda and n.status like 'Emitida' and n.excluido is null)