I'm using the command select
below:
select
f.no_equipe,
h.no_pessoa_fisica,
a.no_cidadao,
d.dt_ficha
from
tb_cds_cad_individual a,
tb_cds_atend_individual b,
rl_cds_atend_individual_ciap c,
tb_cds_ficha_atend_individual d,
tb_equipe f,
tb_cds_prof g,
tb_pessoa_fisica h
where f.nu_ine = g.nu_ine
and g.nu_cns = h.nu_cns
and d.co_cds_prof = g.co_seq_cds_prof
and a.nu_cns_cidadao = b.nu_cartao_sus
and b.co_seq_cds_atend_individual = c.co_cds_atend_individual
and b.co_cds_ficha_atend_individual = d.co_seq_cds_ficha_atend_indivdl
and c.co_ciap = 727
and d.dt_ficha >= '2017-08-01'
and d.dt_ficha <= '2017-08-30'
In this code it returns me 4 fields: team name, professional's name, citizen's name and date of the card.
My problem is in line and a.nu_cns_cidadao = b.nu_cartao_sus
where it only shows the line if the sus card number is equal to the number registered in another table.
I want to change the code so that even if the and a.nu_cns_cidadao = b.nu_cartao_sus
condition is not true, it lists the result and instead appears in the citizen name a.no_cidadao
something like "NO NAME" appears.
I hope you have understood.