Re: Query, view join question. - Mailing list pgsql-general

From Tom Lane
Subject Re: Query, view join question.
Date
Msg-id 18524.1105036756@sss.pgh.pa.us
Whole thread Raw
In response to Re: Query, view join question.  ("Joost Kraaijeveld" <J.Kraaijeveld@Askesis.nl>)
List pgsql-general
"Joost Kraaijeveld" <J.Kraaijeveld@Askesis.nl> writes:
> CREATE OR REPLACE VIEW even AS
>  SELECT DISTINCT abo_his.klantnummer, abo_his.artikelnummer, abo_his.code_retour, abo_klt.aantal_abonnementen,
abo_klt.afgewerkt
>    FROM abo_his
>    JOIN abo_klt ON abo_his.klantnummer = abo_klt.klantnummer
>   WHERE abo_his.abonnement = 238
>   ORDER BY abo_his.klantnummer, abo_his.artikelnummer, abo_his.code_retour, abo_klt.aantal_abonnementen,
abo_klt.afgewerkt;

Okay ... but the view is constraining abo_his.abonnement and outputting
abo_klt.aantal_abonnementen.  Why would you assume that joining on
klantnummer would cause these two fields to necessarily be the same?

            regards, tom lane

pgsql-general by date:

Previous
From: Eric E
Date:
Subject: Re: pg_dump dependencies
Next
From: Tom Lane
Date:
Subject: Re: pg_dump dependencies