0
Good evening, everyone,
Can you help me?
I need to create a view with the data below, however I need to create a condition where when the value of MC.SITUACAO is equal to 'A', the fields MC.VALORPAGO and MC.SITUACAO should be empty (even if the query has values. Below is the consultation I’m performing:
SELECT
PA.EMPRESA,
PA.CONTRATO,
PA.PARCELA,
PA.SITUACAO,
PA.PMT,
PA.IOF,
PA.VCTO,
PA.SALDO,
MC.DATAFINANCEIRA,
MC.VALORPAGO,
MC.SITUACAO
FROM PARCELAS PA
LEFT JOIN MOVIMENTOSCONTABEIS MC ON PA.EMPRESA = MC.EMPRESA
AND PA.AGENCIA = MC.AGENCIA
AND PA.CONTRATO = MC.CONTRATO
AND PA.PARCELA = MC.PARCELA
AND PA.ULTIMASEQUENCIA = MC.SEQUENCIA
pq is using the function
MIN
with theCASE
? and where is the condition to display the field if the value is not "A"?– Ricardo Pontual