"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