Hi there!
I have a doubt about an SQL query, which I don't have any idea on how to proceed.
I need the SQL to bring data only when 'e.dt_vencimento' is less than or equal to 60 days from sysdate.
Below you can see my query, and the line I stuck is the #24.
Thank you already,
Marcelo Melo
SELECT b.nr_contrato,
a.NM_PAGADOR,
a.NR_SEQ_LOTE,
a.dt_referencia,
a.DT_VENCIMENTO,
a.VL_PRE_ESTABELECIDO,
a.VL_COPARTICIPACAO,
a.VL_OUTROS,
a.VL_TITULO,
e.dt_liquidacao,
e.nr_titulo
FROM pls_mensalidade_wcp_v a,
pls_contrato b,
PLS_CONTRATO_PLANO c,
PLS_CONTRATO_PAGADOR d,
titulo_receber e
WHERE b.nr_sequencia = c.nr_seq_contrato
AND d.nr_seq_contrato = b.nr_sequencia
AND a.nr_seq_pagador = d.nr_sequencia
AND a.nr_titulo = e.nr_titulo
AND c.NR_SEQ_PLANO IN (17, 18, 25, 47, 50, 51,54,56,57,58)
AND d.cd_pessoa_fisica IS NOT NULL
and e.dt_liquidacao is null
--and e.dt_vencimento ***here I intend to write the condition***
AND a.dt_referencia =:dt_referencia
ORDER BY 2