HELP with a query with blank fields

From: "J(dot) Manuel Velasco" <tech(at)ubilibet(dot)com>
To: PostgreSQL <pgsql-general(at)postgresql(dot)org>
Subject: HELP with a query with blank fields
Date: 2008-05-27 18:01:27
Message-ID: 1211911287.6194.13.camel@fortaleza
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello,

This is the current query I have:

SELECT dominis.nom, dominis.extensio, dominis.creat, dominis.expira,
titulars.first_name, titulars.last_name, contactes_admin_tec.first_name,
contactes_admin_tec.last_name, dns1.nom, dns2.nom, dominis.redirec,
contactes_fac.nom, grups.nom FROM dominis, contactes_fac, dns as dns1,
dns as dns2, titulars, contactes_admin_tec, grups WHERE
dominis.id_c_f=contactes_fac.id AND dominis.id_dns1=dns1.id AND
dominis.id_dns2=dns2.id AND dominis.id_titular=titulars.id AND
dominis.id_c_a=contactes_admin_tec.id AND contactes_fac.id_grup=grups.id
AND dominis.id_c_f = 724

The problem is that are registers that has not dominis.id_dns2 value and
then they are not extracted. I need to show also these ones.

I try playing with inner join, left join,... but I get this error:

ERROR: referencia invalidad a una entrada de clausula FROM para la
tabla "dominis"
LINE 9: ON dominis.id_dns2 = dns2.id
^
HINT: Hay una entrada para la tabla "dominis", pero este no puede ser
referenciado desde esta parte de la consulta.

Free translation: Invalid reference in FROM clausule. There is an entry
in table dominis but it can't referenced from this part of the query.

I also tried changing
dominis.id_dns2=dns2.id by (dominis.id_dns2=dns2.id or dominis.id_dns2
is null)
but it's wrong, i get more than one record of the field from the
register there is an empty value in id_dns2 field.

Can anybody help to achieve the goal? I really will appreciate.

Thanks in advance.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Volkan =?utf-8?B?WWF6xLFjxLE=?= 2008-05-27 18:05:07 Re: Permission Problem for DELETE
Previous Message Tom Lane 2008-05-27 17:44:30 Re: Permission Problem for DELETE