0
My code is below
he returns me "h. banks as banks" with a number, which is foreign key
I want him to return me to the description of this bank, only that in many cases, h.banco returns me as null
How do I set up the from clause for that?
I tried to add one left join
only he returned me the same record over and over again
select a.numero,
a.competencia,
d.area as setor,
c.nome as nomeprojeto,
e.especificacao as elemento,
e.codigo as codigoelemento,
f.descricao as rubr,
f.rubrica as codigorubrica,
a.valorestimado,
a.observacao,
a.fonterecurso codigofonte,
g.descricao fonte,
a.competenciadespesa,
h.nome as credor ,
h.documento as doccredor,
h.tipopessoa as tipocredor,
h.banco as banco,
h.contacorrente as contacorrente,
h.agencia as agencia,
a.processo,
a.finalidade as objetoSad,
a.datainclusao,
a.datamod
from sad a left join credor h on a.credor = h.codigo,
cronograma b,
projeto c,
organograma d,
elementodespesa e,
rubrica f,
fonterecurso g
where a.cronograma = b.codigo
and b.projeto = c.codigo
and c.organograma = d.codigo
and b.rubrica = f.codigo
and f.elementodespesa = e.codigo
and a.fonterecurso = g.codigo
and a.codigo = 1954
There are some inconsistencies in this SQL of yours. The first, you would have to add each left Join to your place, each row, a left, something else... based on what you are joining the chart tables, elementexpense, fonterecurso, which field?
– Sr. André Baill