Re: Query, view join question.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Joost Kraaijeveld" <J(dot)Kraaijeveld(at)Askesis(dot)nl>
Cc: "Pgsql-General (E-mail)" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Query, view join question.
Date: 2005-01-06 18:39:16
Message-ID: 18524.1105036756@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Joost Kraaijeveld" <J(dot)Kraaijeveld(at)Askesis(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2005-01-06 18:45:59 Re: pg_dump dependencies
Previous Message Eric E 2005-01-06 18:26:47 Re: pg_dump dependencies