Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Show me the same information any times

Author  Topic 

marcio107
Starting Member

2 Posts

Posted - 2012-04-23 : 10:05:33
Hi everybody,

I did one select (View) in my base, but show me the same information any time and not field duplicate. following below. Can you help me?


create or replace view vdic_atendimento_chsbc as

select
atendime.cd_loc_proced
, atendime.cd_ori_ate
, paciente.nm_paciente
, paciente.nm_mnemonico
, atendime.cd_paciente
, paciente.nm_mae
, responsavel.nm_responsavel
, paciente.nr_identidade
, paciente.nr_cpf
, responsavel.nr_identidade
, paciente.tp_cor
, paciente.tp_sexo
, paciente.dt_nascimento
, paciente.cd_cns
, atendime.nr_pre_natal
, paciente.ds_endereco
, paciente.nr_endereco
, paciente.ds_complemento
, paciente.nm_bairro
, cidade.nm_cidade
, paciente.nr_cep
, uf.cd_uf
, paciente.nr_fone
, paciente.nr_celular
, prestador.nm_prestador
, atendime.cd_pro_int_procedimento_entrad
, cid.cd_cid
, atendime.cd_procedimento

From

atendime
, paciente
, responsavel
, cidade
, UF
, prestador
, especialid
, procedimento
, cid, ori_ate
, loc_proced


where

paciente.cd_paciente = atendime.cd_paciente
and ori_ate.cd_ori_ate = atendime.cd_ori_at
and cid.cd_cid = atendime.cd_cid
and loc_proced.cd_loc_proced = atendime.cd_loc_proced
and especialid.cd_especialid = atendime.cd_especialid
and prestador.cd_prestador = atendime.cd_prestador

Thanks and Hugs,

MMachado

yosiasz
Master Smack Fu Yak Hacker

1635 Posts

Posted - 2012-04-23 : 10:28:41
which column do you want to use as you key unique column?

<><><><><><><><><><><><><><><><><>
If you don't have the passion to help people, you have no passion
Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2012-04-23 : 11:15:22
By the way, SQLTeam is a Microsoft SQL Server website, and you posted a view definition for Oracle. If you're using Oracle, try posting at http://dbforums.com/.
Go to Top of Page

marcio107
Starting Member

2 Posts

Posted - 2012-04-23 : 11:37:29
Sorry Man, I´m begining here and with the system.

but my primary key is cd_paciente.

Thanks,

MMachado

MMACHADO
Go to Top of Page
   

- Advertisement -