HELP with a query with blank fields - Mailing list pgsql-general

From J. Manuel Velasco
Subject HELP with a query with blank fields
Date
Msg-id 1211911287.6194.13.camel@fortaleza
Whole thread Raw
Responses Re: HELP with a query with blank fields
List 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.


pgsql-general by date:

Previous
From: Chris
Date:
Subject: Re: conditional alter table
Next
From: Bob Pawley
Date:
Subject: Re: Bottom Posting