Doubt with Joins

Поиск
Список
Период
Сортировка
От Ezequias Rodrigues da Rocha
Тема Doubt with Joins
Дата
Msg-id 55c095e90610020841i134d19afwbf6a33af0ed50c7a@mail.gmail.com
обсуждение исходный текст
Список pgsql-sql
Hi list,<br /><br />I have the following query:<br /><br />select distinct <a href="http://cli.id">cli.id</a> as id,
cli.nomeas Nome, c.numero as cardpass, cli.documento as Documento, cli.endereco as Endereco,<br />cli.complemento as
Complemento,cli.bairro as Bairro, cli.cidade as Cidade, cli.estado as UF, <br />cli.cep as CEP, cli.telefone as
Telefone,cli.email, cli.sexo as Sexo, cli.estado_civil, cli.data_nascimento, cli.escolaridade, c.pontos,
cli.informacoes_cliente<br />from base.cliente as cli, base.cartao as c, base.sessao as s, base.evento as e,
base.ingressoas i<br />where c.cliente_id = <a href="http://cli.id">cli.id</a><br />and <a href="http://c.id">c.id</a>
=i.cartao_id  <-- records only appears when I have records on table "i" <br />and <a href="http://s.id">s.id</a> =
i.sessao_id<-- records only appears when I have records on table "i"<br />and s.evento_id = <a
href="http://e.id">e.id</a><-- records only appears when I have records on table "e" <br />and <span
style="font-weight:bold;">cli.Nome</span> Like 'ANA%'<br />and e.nome = 'EVENT1'  <-- Some times I don't want to
passthis parameter<br />and s.descricao = 'SESSION 1' <-- Some times I don't want to pass this parameter <br />and
c.estado= 1<br />order by 1<br /><br />but my query vary according my parameters. My question is why I only get records
thatexist in both tables with this "ids" ? (event e and session s)<br clear="all" /><br />It is a case of an outer join
?What should I do if I only have a cli.Nome parameter passed ?<br /><br />I don't know I I made myself clear.<br /><br
/>Regards<br/>Ezequias<br />-- <br /> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-<br
/>                                  Atenciosamente(Sincerely) <br />                        Ezequias Rodrigues da
Rocha<br/> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-<br />A pior das democracias ainda é
melhordo que a melhor das ditaduras<br />The worst of democracies is still better than the better of dictatorships <br
/><ahref="http://ezequiasrocha.blogspot.com/">http://ezequiasrocha.blogspot.com/</a> 

В списке pgsql-sql по дате отправления:

Предыдущее
От: chester c young
Дата:
Сообщение: Re: regexp_replace usage
Следующее
От: "Rodrigo Sakai"
Дата:
Сообщение: SEQUENCES