0
I wanted to ride a inner join
that brings only the values filtered by a minimum value field
select min(data_vencimento) from pagamento where cod_situacao = 3,
cli.cpf, cli.nome, con.data_inicio, con.data_fim,
sit.situacao, con.valor_mensalidade from cliente cli
inner join contrato con on con.cpf = cli.cpf
inner join pagamento pag on pag.COD_CONTRATO = con.COD_CONTRATO
inner join situacao sit on sit.cod = pag.cod_situacao;
How were your tables made? Where do you get this minimum value?
– Francisco
would be a maturity as varchar and payments are automatically generated in the system c#.
– Marcus Vinicius
has payment situation: 1 = open, 2 = paid, 3 past due
– Marcus Vinicius
I managed five payments, left three open, one overdue, one paid. As an example : 1º Due date = 09/07/2017 open 2° Due date = 09/08/2017 open wanted to show only one line with maturity for 09/07/2017
– Marcus Vinicius
@Marcusvinicius , have you studied relational algebra? SQL is a partial implementation of this mathematics, it can help a lot in your queries understand the algebraic part behind all this
– Jefferson Quesado